Take the 2-minute tour ×
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. It's 100% free, no registration required.

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 user.country='USA' ?

thanks for your helps

share|improve this 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 dba.se - try SO? –  Jack Douglas May 18 '12 at 21:11
add comment

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.

2 Answers

up vote 0 down vote accepted
select f.friendid from friends f, user u where u.userid = f.userid and u.country = '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
add comment
select f.friendid 
from friends f  
  inner join user u 
    on u.userid = f.userid 
where u.country='usa'
share|improve this answer
add comment

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