From: | Nick Barr <nicky(at)chuckie(dot)co(dot)uk> |
---|---|
To: | Alexander Cohen <alex(at)toomuchspace(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: select statement sorting |
Date: | 2004-03-31 15:44:10 |
Message-ID: | 406AE74A.90509@chuckie.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alexander Cohen wrote:
> is it possible to have postgres return a "SELECT * FROM table ORDER BY
> table_column" query that is not case sensitive order?
>
> if i have these words in a column:
>
> Alex
> alex
> Barbara
> Cohen
>
> i will get them back in the following order in the tuples:
>
> Alex
> Barbara
> Cohen
> alex
>
> But i want them back likke this:
>
> Alex
> alex
> Barbara
> Cohen
>
> Is this possible or do i need to sort them myself after the query
> returns?
>
> Also, i noticed that postgres will let me create groups, databases and
> users with spaces in their names, is this ok or should i check this
> beforehand and not allow this?
>
> thanks!
>
Try
SELECT * FROM table ORDER BY LOWER(table_column);
or of course
SELECT * FROM table ORDER BY UPPER(table_column);
Nick
From | Date | Subject | |
---|---|---|---|
Next Message | Indibil | 2004-03-31 16:07:42 | Re: Error on deleting |
Previous Message | mlists | 2004-03-31 15:36:12 | How can I change type of column |