Search Postgresql Archives

Re: Ordering in SELECT statement

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

 



On Jun 26, 2007, at 14:41 , kdealba@xxxxxxxx wrote:
and what I need is the following ("old fashion", that is, the "SPACE" is another character whose ASCII value is before any other LATIN letter's!!)
AB  CD
AB  EF
ABAB
ABD  E

	What you don't want :

peufeu=> SELECT column1 FROM (VALUES ('ABCD'), ('A BCD'), ('abcd'), ('ABcd'), ('AB'), ('AbC d')) AS foo ORDER BY column1;
 column1
---------
 AB
 abcd
 AbC d
 ABcd
 ABCD
 A BCD
(6 lignes)

	What you want :

peufeu=> SELECT column1 FROM (VALUES ('ABCD'), ('A BCD'), ('abcd'), ('ABcd'), ('AB'), ('AbC d')) AS foo ORDER BY string_to_array( column1, ' ' );
 column1
---------
 A BCD
 AB
 AbC d
 abcd
 ABcd
 ABCD
(6 lignes)


[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