Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5MCj5a52168 for ; Fri, 22 Jun 2001 08:45:05 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from smtp6ve.mailsrvcs.net (smtp6vepub.gte.net [206.46.170.27]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5KLVRa66599 for ; Wed, 20 Jun 2001 17:31:27 -0400 (EDT) (envelope-from anepon@verveinternet.com) Received: from [141.151.9.204] (adsl-141-151-9-204.bellatlantic.net [141.151.9.204]) by smtp6ve.mailsrvcs.net (8.9.1/8.9.1) with SMTP id VAA34267510 for ; Wed, 20 Jun 2001 21:31:24 GMT Reply-To: From: "Ari Nepon" To: "Pgsql-Sql" Subject: Help with a double left join Date: Wed, 20 Jun 2001 17:34:30 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200106/362 X-Sequence-Number: 3649 I am trying to do a left join FROM [a table with two columns that have foreign IDs] LEFT JOIN [two other tables, each has a unique ID]. I have the left join working where I join only two tables (not three): SELECT track.ID, track.employee, track.client, track.task, track.description, track.hours_used, track.f_date, project.project_name FROM track LEFT JOIN project ON track.project=project.project_id WHERE track.client LIKE '%MMColParam%' the two tables are track and project. Track is the left of the left join. It holds the foreign keys. project (and later clients) are the columns with the keys. I need to also left join clients ON track.client=client.ID. Would someone tell me how the SQL statement should be that allows me to do the two left joins? Would it be: SELECT track.ID, track.employee, track.task, track.description, track.hours_used, track.f_date, project.project_name, clients.name FROM track LEFT JOIN project ON track.project=project.project_id AND LEFT JOIN client ON track.client=clients.ID WHERE track.client LIKE '%MMColParam%' '%MMColParam%' is just a variable used to hold a querystring variable in case anyone was wondering. Thanks, Ari (database is MS access. language is ASP. Whole thing will eventually be redone in PostgreSQL and PHP, just as soon as I learn them:) ~~~~~~~~~~~~~~~~~~~~~~~~~ Ari Nepon MRB Communications 4520 Wilde Street, Ste. 2 Philadelphia, PA 19127 p: 215.508.4920 f: 215.508.4590 http://www.mrbcomm.com ----------------------------------------------------------------------- Sign up for our email list and receive free information about topics of interest to nonprofit communications, marketing, and community building professionals. Free resources, articles, tips. Go to http://www.mrbcomm.com and use the Mailing List form. -----------------------------------------------------------------------