Search Postgresql Archives

Re: ORDER BY options (how to order data as AAA, aaa, BBB, bbb, ... ZZZ, zzz)

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

 



On Tue, 10 May 2005 07:41 pm, Julian Legeny wrote:
> Hello,
> 
>    I have following problem:

> But I would like to sort all data as following:
> 
>    NAME
> -----------
>    AAA
>    aaa
>    BBB
>    bbb
>    CCC
>    ccc
> 
> 
> How can I write sql command (or set up ORDER BY options) for selecting that?
> 
SELECT * FROM MY_TABLE ORDER BY lower(NAME), NAME

The second NAME is to ensure that AAA comes before aaa, otherwise the order is undetermined.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[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