Re: selecting latest record

From: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: selecting latest record
Date: 2009-09-22 10:02:32
Message-ID: 20090922100232.GA26478@apartia.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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,

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2009-09-22 10:08:46 Re: selecting latest record
Previous Message Pavel Stehule 2009-09-22 09:56:54 Re: selecting latest record