sql foreign key references two tables