Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have 2 tables as like seen :

user table : id, userid , country

friends table : id, userid , friendid

so i want to get friendid rows from friends table where friends.userid == user.userid and'USA' ?

thanks for your helps

share|improve this question

closed as off topic by Jack Douglas May 18 '12 at 21:11

Questions on Database Administrators Stack Exchange are expected to relate to database administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What exact error you are getting? – neeraj Apr 9 '12 at 11:08
there is no error i say i couldnt compile the right query : ) and friendids should be unique ? – user1031143 Apr 9 '12 at 11:12
This is too basic for - try SO? – Jack Douglas May 18 '12 at 21:11
up vote 0 down vote accepted
select f.friendid from friends f, user u where u.userid = f.userid and = 'usa';

if you are using any query and it throws an error please describe your error...

share|improve this answer
Do not teach people to use SQl antipatterns like implicit joins. – HLGEM May 18 '12 at 13:22
select f.friendid 
from friends f  
  inner join user u 
    on u.userid = f.userid 
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.