Re: Need help for constructing query - Mailing list pgsql-general

From Marco
Subject Re: Need help for constructing query
Date
Msg-id 4d8ca252$0$7654$9b4e6d93@newsspool1.arcor-online.net
Whole thread Raw
Responses Re: Need help for constructing query  ("David Johnston" <polobo@yahoo.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: ERROR: type "foo_20110307_id_seq" already exists (expected relation "foo_20110307_id_seq" already exists)
Next
From: Marco
Date:
Subject: Need help for constructing query