Search Postgresql Archives

Re: Need help for constructing query

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

 



Just want to add:

> 1) Display the rows with the highest date per id. That gives as many rows as
>    ids exist.
>
> select id, max(date) from mytable group by id;
> 
> gives just the id and the date, not the other values. I think of doing this
> in two steps:

select id, max(date),min,value,max from mytable group by id,min,value,max;

Gives too many rows. I don't know why. If I can manage to fix the query above
just to output one row per id I can solve it.


Marco


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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