wrong answer

From: "A(dot) R(dot) Van Hook" <hook(at)lake-lotawana(dot)mo(dot)us>
To: postgresql sql list <pgsql-sql(at)postgresql(dot)org>
Subject: wrong answer
Date: 2007-08-21 13:09:50
Message-ID: 46CAE41E.8020707@lake-lotawana.mo.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)lake-lotawana(dot)mo(dot)us
avanhook3(at)comcast(dot)net

(816) 578-4704 - Home
(816) 629-0071 Cell

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2007-08-21 13:23:12 Re: wrong answer
Previous Message Michael Glaesemann 2007-08-21 01:36:29 Re: Join query help