Re: selecting latest record - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: selecting latest record
Date
Msg-id 20090922100232.GA26478@apartia.fr
Whole thread Raw
In response to Re: selecting latest record  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-sql
On Tue, Sep 22, 2009 at 11:56:54AM +0200, Pavel Stehule wrote:
> 
> there are more ways - depends on what you wont.
> 
> one way is
> 
> SELECT *
>    FROM price
>   WHERE (id_product, date) = (SELECT id_product, max(date)
>                                                                FROM price
>                                                               GROUP BY
> id_product)

Nice. 

I didn't know one could have several args in a single WHERE clause.

Thanks,


pgsql-sql by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: selecting latest record
Next
From: "A. Kretschmer"
Date:
Subject: Re: selecting latest record