Re: DISTINCT ordering - Mailing list pgsql-novice

From Ron St-Pierre
Subject Re: DISTINCT ordering
Date
Msg-id 4118F046.8050303@syscor.com
Whole thread Raw
In response to DISTINCT ordering  (Jake Stride <nsuk@users.sourceforge.net>)
Responses Re: DISTINCT ordering
Re: DISTINCT ordering
List pgsql-novice
Jake Stride wrote:

>I have a view from which I select values, but I need to do a 'SELECT
>DISTINCT' query on a 'varchar' column and order by lower case eg:
>
>SELECT DISTINCT name FROM someview ORDER BY lower(name)
>
If this is what you want, wouldn't 'Foo' and 'foo' both show up in your
output? If you only wanted one 'foo' you could use:

SELECT DISTINCT lower(name) FROM someview ORDER BY lower(name);

otherwise something like:
SELECT lower (SS.name) FROM (SELECT DISTINCT name FROM someview) SS ORDER BY lower(name);
would return 'foo' twice in the output.


Ron


pgsql-novice by date:

Previous
From: Ron St-Pierre
Date:
Subject: Re: Script done... Function won´t wo
Next
From: Eduardo Vázquez Rodríguez
Date:
Subject: Query result to a file