Search Postgresql Archives

Re: select distinct w/order by

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux