Mark

also clearer if you use ansi join syntax (which we all should do), means if
you have any NULL
FK (ie project manager has not been appointed) you can use and OUTER join

SELECT
  p.project_name, s.staff_name, m.staff_name
FROM
  project p JOIN
  staff s ON s.staff_id = s.staff_id JOIN
  staff m ON m.staff_id = s.staff_id


----- Original Message -----
From: Mark Derricutt <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Friday, 26 January 2001 09:52
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"

Reply via email to