Mike Sosteric wrote:
> 
> Hi all
> 
> I' wondering if someone can help me out here.
> 
> I need to do a three table join. Normally not a problem but in this case I have to 
>select usernames from a users table twice. One for each of two other tables. I'll 
>need to use a user_id (int) to do the select and then join on the name found. The 
>table structure looks something like this
> 
> USERS
>  user_id
>  name
> 
> USERLIST
>   user_id
> 
> STUDENTLIST
>  user_id
> 
> I want to be able to do something like this
> 
> select USERS.name, USERS.name, USERLIST.user_id , STUDENTLIST.user_id student_id
> from USERS, USERLIST, STUDENTLIST

select USERS.name as name1, USERS.name as name2, USERLIST.user_id, ...

> WHERE
> 
> and then have the name of the user from the user_id in both the USERLIST and the 
>STUDENTLIST
> 
> my question is in a case like this, how do you correctly associate the 'name' with 
>each user_id??

Done by where (via name1, name2 etc.)

> 
> tia for any help
> 
> mike
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to