Unix Technical Forum

wrong answer

This is a discussion on wrong answer within the pgsql Sql forums, part of the PostgreSQL category; --> I have a simple (and incorrect queuer) that gives the wrong answer. Can someone show me the correct syntax? ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 06:49 PM
A. R. Van Hook
 
Posts: n/a
Default wrong answer

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



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 06:49 PM
Richard Huxton
 
Posts: n/a
Default Re: wrong answer

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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com