Re: Complex Query - Data from 3 tables simultaneously - Mailing list pgsql-sql

From
Subject Re: Complex Query - Data from 3 tables simultaneously
Date
Msg-id 4538E1203665624F97A8494BCF2716E5F4858C@blrx2kmbgl102.blr.amer.dell.com
Whole thread Raw
In response to Complex Query - Data from 3 tables simultaneously  (<Amit_Wadhwa@Dell.com>)
List pgsql-sql
Thanks a lot, that worked for me!

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: Thursday, October 27, 2005 2:47 PM
To: Wadhwa, Amit
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Complex Query - Data from 3 tables simultaneously

Amit_Wadhwa@Dell.com wrote:
>
> Basically I want a raw dump of data
> - Should have all the shipments regardless of whether they have any
> material items entered or not
> - Should have all Material Items for Every Shipment regardless of
> whether it was issued or not.
>
> I know I need an outer join (Do I Not?), but am confused as to how to
> implement it.
> Because this seems to be a requirement of a reversed outer join (??)

SELECT s.*, m.*, i.*
FROM  shipments s
LEFT JOIN  materials m
ON s.www = m.xxx
LEFT JOIN  issued i
ON m.yyy = i.zzz
WHERE s.whatever = something

--   Richard Huxton  Archonet Ltd



pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: why vacuum
Next
From: Mario Splivalo
Date:
Subject: Re: why vacuum