X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A3D2DAA85 for ; Thu, 27 Oct 2005 06:20:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42143-09 for ; Thu, 27 Oct 2005 09:20:16 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 166DCDB083 for ; Thu, 27 Oct 2005 06:20:18 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 3D46B40DAB8; Thu, 27 Oct 2005 10:20:14 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 3F41515EDA; Thu, 27 Oct 2005 10:17:31 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00867-05; Thu, 27 Oct 2005 10:17:28 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 89CF915ED5; Thu, 27 Oct 2005 10:17:28 +0100 (BST) Message-ID: <43609B27.6060303@archonet.com> Date: Thu, 27 Oct 2005 10:17:27 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Amit_Wadhwa@Dell.com Cc: pgsql-sql@postgresql.org Subject: Re: Complex Query - Data from 3 tables simultaneously References: <4538E1203665624F97A8494BCF2716E5F4853F@blrx2kmbgl102.blr.amer.dell.com> In-Reply-To: <4538E1203665624F97A8494BCF2716E5F4853F@blrx2kmbgl102.blr.amer.dell.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 required=5 tests=[AWL=0.009, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/361 X-Sequence-Number: 23214 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