[Zope] converting SQL select list into unique values

Steen Suder CAB@Earthling.net
Fri, 07 Jan 2000 23:28:31 +0100


Darcy Clark wrote:
> 
> I have a non-unique column in a MySQL table - I have looked hard for a
> way in SQL to convert the results of a SELECT into a list of unique
> values. I know how to define a table at CREATE to have UNIQUE columns
> but this is not what I want to do.
> 
> For example :
> 
> If the result of the SELECT is :
> 1, 3, 3, 4, 2, 6, 8, 9, 4, 2, 3, 6
> 
> I would like to return:
> 1, 2, 3, 4, 6, 8, 9
> 
> i.e. only the unique values of the list.
> 
> any pointers ? if SQL can't do this, can Zope ? (I'm sure Zope can do
> it, it can do everything :)
> 
> Darcy

If I remember right...

select not_unique
from table
GROUP BY not_unique;

The group by aggregate will do the thing you ask for.

-- 
Best regards / Mvh.,
Steen Suder, sysadm kollegie6400.dk -|- OpenSource --- Sign of the time

Scan-Aqua ADVARSEL WARNING http://www.uk.k64.dk/sfs/Scan-Aqua/