Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3F6469FB636 for ; Thu, 15 Feb 2007 00:03:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 77942-09 for ; Thu, 15 Feb 2007 00:03:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 5E7749FB629 for ; Thu, 15 Feb 2007 00:03:03 -0400 (AST) Received: (qmail 31656 invoked by uid 500); 15 Feb 2007 04:02:52 -0000 Date: Wed, 14 Feb 2007 22:02:52 -0600 From: Bruno Wolff III To: "Edward W. Rouse" Cc: pgsql-sql@postgresql.org Subject: Re: problem with join Message-ID: <20070215040252.GA24667@wolff.to> Mail-Followup-To: Bruno Wolff III , "Edward W. Rouse" , pgsql-sql@postgresql.org References: <003d01c75086$829326b0$143c520a@ntc2s.comsquared.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003d01c75086$829326b0$143c520a@ntc2s.comsquared.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200702/160 X-Sequence-Number: 27494 On Wed, Feb 14, 2007 at 17:21:44 -0500, "Edward W. Rouse" wrote: > > I tried using coalesce(count(value4)) and case count(value4) = 0 > with no luck. I tried left and right joins and the right join gave me > the same results while the left join gave me rows like: That is because neither side of the join had all combinations of numbers and letters. One approach would be to cross join a table with 'one', 'two', and 'three' with one with 'a', 'b', 'c', 'd', 'e', and 'f'. And then left join the query above to it.