Help writing database queries for derby?

Posted by outsyncof on Stack Overflow See other posts from Stack Overflow or by outsyncof
Published on 2010-03-12T02:30:42Z Indexed on 2010/03/12 2:37 UTC
Read the original article Hit count: 398

Filed under:
|

I have a database containing multiple tables (Person, Parents, etc)

Person table has certain attributes particularly ssn, countryofbirth and currentcountry.

Parents table has ssn, and fathersbirthcountry

I'm trying to output the SSNs of all people who have the same countryofbirth as their fathersbirthcountry and also have same currentcountry as fathersbirthcountry.

SELECT Person.ssn 
FROM Person, Parents 
WHERE fathersbirthcountry = countryofbirth 
AND currentcountry = fathersbirthcountry;

the above doesn't seem to be working, could anyone please help me out?

© Stack Overflow or respective owner

Related posts about database-queries

Related posts about derby