Search Postgresql Archives

Re: Query problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Naz Gassiep wrote:
> Aside from the messy nomenclature, is anyone able to spot why 
> the "sum" column from the first query is not returning 7, as 
> the second query suggests that it should? I know that this is
> probably simple, and that It's probably going to jump out at
> me the minute I hit "Send", but if I don't hit send, then I'll
> never see it hehe.
> 
> twerl=# SELECT ... SUM(contacts.id) ... FROM ... contacts ...
> ... | sum | ...
> ...-+-----+-...
> ... | 594 | ...
> (1 row)
>  
> twerl=# select count(*) from contacts where groupid = 3;
>  count
> -------
>      7
> (1 row)

That's an easy one.

I assume that there are three rows in table "contacts", and
the values of the "id" column are 42, 123 and 429 (or similar).

Yours,
Laurenz Albe

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux