Thanks guys, works a treat. Yip, it was the Alias thing... interesting.

----- Original Message -----
From: "Roger Baklund" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "asherh" <[EMAIL PROTECTED]>
Sent: Wednesday, February 27, 2002 2:39 PM
Subject: RE: Query Problem...


> * asherh
> > An example of the record output I was after is...
> >
> > ProjectID        ProjectOwner    ProjectManager
> > A12345             Bob Smith           John Smith
> >
> > from tables:
> >
> > User -
> > UserId    FullName
> > 1            Bob Smith
> > 2            John Smith
> >
> > Project -
> > ProjectId    ProjectOwner   ProjectManager
> > A12345        1                        2
> >
> > I have tried all sorts of joins and statements without much
> > success... I can
> > obtain one name or both names if they are the same... but not different
> > names together in the one record.
> >
> > Can you possibly provide an example of the specific joins you are
talking
> > about. I think I must be missing something fundamental here.
>
> You don't show your failing joins, but my guess is you are missing
aliases,
> which are needed when joining the same table multiple times:
>
> SELECT ProjectId,owner.FullName,manager.FullName
>   FROM Project
>   LEFT JOIN User AS owner ON
>     owner.UserId = Project.ProjectOwnerID
>   LEFT JOIN User AS manager ON
>     manager.UserId = Project.ProjectManagerID
>   WHERE
>     ProjectId = 'A12345';
>
> --
> Roger
> query
>
>
>



---------------------------------------------------------------------
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