Thierry Lam, el 4 de mayo a las 14:47 me escribiste:
> I'm using SQLObject 0.7.0 and I'm having lots of trouble retrieve a list
> of distinct columns from my table. What is the equivalent of the following
> in SQLObject?
>
>
>
> Table: users
>
> Columns: id, name, age
>
>
>
> SELECT distinct name FROM users
>
>
>
> The only way I can do the above is the following which uses raw sql
> statement:
>
>
>
> c = users._connection
>
> return c.queryAll('SELECT distinct name FROM users')
>
>
>
> Is there an alternative way to do the above?
An OO alternative:
names = set([u.name for u in users.select()])
If you need performance, I think c.queryAll() is the way to go.
--
LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
------------------------------------------------------------------------
E-Mail / JID: [EMAIL PROTECTED]
GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2
GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
------------------------------------------------------------------------
they wrap me up in the back of the trunk
packed with foam and blind drunk
they won't ever take me alive
cause they all drive killer cars
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss