pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
wrong answer
2+ messages / 2 participants
[nested] [flat]

* wrong answer
@ 2007-08-21 13:09  A. R. Van Hook <hook@lake-lotawana.mo.us>
  0 siblings, 1 reply; 2+ messages in thread

From: A. R. Van Hook @ 2007-08-21 13:09 UTC (permalink / raw)
  To: 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@lake-lotawana.mo.us
avanhook3@comcast.net

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: wrong answer
@ 2007-08-21 13:23  Richard Huxton <dev@archonet.com>
  parent: A. R. Van Hook <hook@lake-lotawana.mo.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2007-08-21 13:23 UTC (permalink / raw)
  To: A. R. Van Hook <hook@lake-lotawana.mo.us>; +Cc: pgsql-sql

A. R. Van Hook wrote:
> 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
           ^^^
Simple typo - you've used sum() not count()

>     qs "select count(*) from registry where ref =3"

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-08-21 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 13:09 wrong answer A. R. Van Hook <hook@lake-lotawana.mo.us>
2007-08-21 13:23 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox