Re: Multicolumn order by

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

 



Theo Kramer <theo@xxxxxxxxxxx> writes:
> select * from mytable where
>   (c1 = 'c1v' and c2 = 'c2v' and c3 >= 'c3v') or
>   (c1 = 'c1v' and c2 > 'c2v') or
>   (c1 > 'c1v')
>   order by c1, c2, c3;

Yeah ... what you really want is the SQL-spec row comparison operator

select ... where (c1,c2,c3) >= ('c1v','c2v','c3v') order by c1,c2,c3;

This does not work properly in any current PG release :-( but it does
work and is optimized well in CVS HEAD.  See eg this thread
http://archives.postgresql.org/pgsql-hackers/2006-02/msg00209.php

			regards, tom lane


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux