Reputation: 1
I'm having problems with the foreign keys. I have a table DETAILS that contains general details with the NAME being the primary key and another table SYMTOMS with two columns NAME and SYM. I have tried to refernece DETAILS to SYMPTOMS through NAME buy i get error 1452 Please help.
I tried setting foreign keys checks to 0. now the error doesnt occur but what i want is this query to work
select SYM from DETAILS where NAME='a';
It doesnt work. it says details table doesnt have a col SYM but I have linked them through foreign key.
DO i need to use apply JOIN. If yes,Please give the statement
Upvotes: 0
Views: 497
Reputation: 37253
you must use join between the tables
select SYM from DETAILS
INNER JOIN SYMTOMS
ON SYMTOMS.,,,, = DETAILS.,,,, --- // fill those comma by the relation between the two tables ,
where NAME='a';
Upvotes: 1