X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 62B3D9FA2D8 for ; Fri, 26 May 2006 13:41:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 68674-07 for ; Fri, 26 May 2006 13:41:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by postgresql.org (Postfix) with ESMTP id 48F289FA12E for ; Fri, 26 May 2006 13:41:28 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2Dk-1FjfNP0QpC-0000kA; Fri, 26 May 2006 18:41:27 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1FjfNO-0003Hp-00 for pgsql-general@postgresql.org; Fri, 26 May 2006 18:41:26 +0200 Date: Fri, 26 May 2006 18:41:26 +0200 From: "A. Kretschmer" To: pgsql-general@postgresql.org Subject: Re: Syntax question Message-ID: <20060526164126.GA12547@webserv.wug-glas.de> References: <20060526160925.61343.qmail@web53504.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060526160925.61343.qmail@web53504.mail.yahoo.com> X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/1319 X-Sequence-Number: 96111 am 26.05.2006, um 9:09:25 -0700 mailte John Taylor folgendes: > I have a select statement that goes as follows: > > SELECT * FROM product prod, prod_alias pa, category cat, company co > WHERE prod.catid = cat.catid > AND prod.coid = co.coid > AND prod.prodid = pa.prodid; > > If possible, I want to change the statement so that I get output > regardless of whether there's a match between prod.prodid and > pa.prodid. IOW, if there's a match between prod.prodid and pa.prodid, > I want the output from both the product table and the prod_alias > table. if there's no match, I still want the output from product > table. Can I do this in one select statement? I think, you should read about 'left outer join'. http://www.postgresql.org/docs/8.1/interactive/queries-table-expressions.html#QUERIES-FROM HTH, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47215, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===