Re: Distinct on a non-sort column

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Distinct on a non-sort column
Date: 2011-11-05 19:58:22
Message-ID: 4EB5955E.4000908@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/05/11 11:39 AM, Cstdenis wrote:
> example query: /select distinct on (user_id) * from stories order by
> date_submitted desc limit 10;/

select user_id,max(date_submitted) from stories group by date_submitted;

?

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Antonio Goméz Soto 2011-11-05 21:37:24 Re: What is *wrong* with this query???
Previous Message Tom Lane 2011-11-05 19:49:30 Re: Distinct on a non-sort column