View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 07:13 AM
Bill Karwin
 
Posts: n/a
Default Re: simple (?) query--help

"Bosconian" <bosconian@planetx.com> wrote in message
news:w6-dnT2MIerY3DreRVn-rg@comcast.com...
> I need to return a list of locationid's based on a specific userid's
> locationid.
>
> For example if userid equals 1, the query would return
>
> userid location
> 1 1
> 3 1


Your description is not clear. Do you mean return all users at the same
location as the specified userid?

SELECT u2.userid, u2.locationid
FROM user AS u INNER JOIN user AS u2
ON u.locationid = u2.locationid
WHERE u.userid = 1;

Regards,
Bill K.


Reply With Quote