Re: select distinct w/order by - Mailing list pgsql-general

From Stephan Szabo
Subject Re: select distinct w/order by
Date
Msg-id 20040401083342.W936@megazone.bigpanda.com
Whole thread Raw
In response to Re: select distinct w/order by  ("John Liu" <johnl@emrx.com>)
List pgsql-general
On Thu, 1 Apr 2004, John Liu wrote:

> 1. In the database allowing 'illegal distinct/w orderby not in the target
> list'
> select distinct drugname, drugid, encdate from CCMMed where pnum_site
> ='1913789_MC' order by drugname, encdate, mshdatetime desc;
>
> 2. In Pg, use your query group by then order by -
> select drugname, drugid, encdate from ccmmed where pnum_site ='1913789_MC'
> group by drugname, drugid, encdate order by max(mshdatetime);

This should be order by drugname, encdate, max(mshdatetime) to be
equivalent to the above I would think.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: A simple question about Read committed isolation level
Next
From: Nick Barr
Date:
Subject: Re: Select Union