Search Postgresql Archives

Re: SELECT DISTINCT ... ORDER BY problem

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

 



On Tue, Dec 9, 2008 at 9:02 AM, Grzegorz Jaśkiewicz <gryzman@xxxxxxxxx> wrote:> or even, when you change bar to proper type - that is, timestamp>> SELECT distinct foo,  min(bar) as minbar, max(bar) as maxbar FROM> table WHERE bar < '2008-12-07>  16:32:46' AND tbl_id=153 ORDER BY bar LIMIT 1;
but than (after sec of thinking), you could just do
SELECT foo, min(bar) AS minbar, max(bar) AS maxbar FROM tableWHERE ..blabla.. GROUP BY foo ORDER BY maxbar LIMIT 1;




-- GJ
-- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

[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