Sorry. there was a typo there. Should have been
select p.project_name, s.staff_name, m.staff_name
from project p, staff s, staff m
where s.staff_id = p.staff_id
and m.staff_id = p.manager_id
Stacey
> -----Original Message-----
> From: Stacey Verner
> Sent: Friday, 26 January 2001 9:52 a.m.
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Join SQL?
>
>
> You need to alias staff twice.
>
> eg.
>
> select p.project_name, s.staff_name, m.staff_name
> from project p, staff s, staff m
> where s.staff_id = p.staff_id
> and m.staff_id = s.manager_id
>
> Stacey
>
> > -----Original Message-----
> > From: Mark Derricutt [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 26 January 2001 9:53 a.m.
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: Join SQL?
> >
> >
> > I know I've asked this before, but I've plain forgotten what
> > the syntax is.
> >
> > Say I have two tables: staff, and project:
> >
> > staff fields: staff_id, staff_name
> > project fields: project_id, project_name, staff_id, manager_id
> >
> > Both staff_id and manager_id in project refer to a record
> in the staff
> > table. How can I do a join/lookup to return a result set
> > with project_name,
> > staff_name, manager_name. But I'm stumped on the
> > manager_name, I remember
> > doing this before but can;t for the life of me remember the
> > join I need to
> > lookup into the same table...
> >
> > Mark
> >
> >
> > --------------------------------------------------------------
> > -------------
> > New Zealand Delphi Users group - Delphi List -
> > [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> >
> --------------------------------------------------------------
> -------------
> New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"