Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id C80E89F966B for ; Tue, 21 Aug 2007 10:20:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 38952-06 for ; Tue, 21 Aug 2007 10:19:53 -0300 (ADT) X-Greylist: delayed 00:05:01.955836 by SQLgrey-1.7.5 Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [216.148.227.153]) by postgresql.org (Postfix) with ESMTP id 67FE29F95B0 for ; Tue, 21 Aug 2007 10:19:58 -0300 (ADT) Received: from [192.168.1.6] (c-69-242-166-153.hsd1.mo.comcast.net[69.242.166.153]) by comcast.net (rwcrmhc13) with ESMTP id <20070821130951m13005d1n1e>; Tue, 21 Aug 2007 13:09:52 +0000 Message-ID: <46CAE41E.8020707@lake-lotawana.mo.us> Date: Tue, 21 Aug 2007 08:09:50 -0500 From: "A. R. Van Hook" User-Agent: Thunderbird 1.5.0.12 (X11/20070719) MIME-Version: 1.0 To: postgresql sql list Subject: wrong answer Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/166 X-Sequence-Number: 29104 I have a simple (and incorrect queuer) that gives the wrong answer. Can someone show me the correct syntax? t "select sum(s.ref), r.value, s.ref from registry as s left join referralkey as r on (s.ref = r.cd) group by s.ref, r.value order by r.value, s.ref" sum | value | ref ------+-----------------+----- 3462 | A Friend | 3 150 | Bridal Guide | 6 33 | Coupon | 11 yet qs "select count(*) from registry where ref =3" count = 1154 qs "select count(*) from registry where ref=6" count = 25 qs "select count(*) from registry where ref=11" count = 3 thanks -- Arthur R. Van Hook hook@lake-lotawana.mo.us avanhook3@comcast.net (816) 578-4704 - Home (816) 629-0071 Cell