Re: Complex Query - Data from 3 tables simultaneously

From: Richard Huxton <dev(at)archonet(dot)com>
To: Amit_Wadhwa(at)Dell(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Complex Query - Data from 3 tables simultaneously
Date: 2005-10-27 09:17:27
Message-ID: 43609B27.6060303@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Amit_Wadhwa(at)Dell(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2005-10-27 10:21:20 Re: why vacuum
Previous Message Richard Huxton 2005-10-27 09:14:21 Re: handling money type