[Zope] converting SQL select list into unique values
Phil Harris
phil.harris@zope.co.uk
Fri, 7 Jan 2000 22:40:07 -0000
or even
select distinct non_unique
from table
----- Original Message -----
From: "Steen Suder" <CAB@earthling.net>
To: <zope@zope.org>
Sent: Friday, January 07, 2000 10:28 PM
Subject: Re: [Zope] converting SQL select list into unique values
> 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/
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>