6 Apr 14:31
Re: select only one column, not the whole record
From: Frank Wagner <frank.wagner <at> nofusion.de>
Subject: Re: select only one column, not the whole record
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-06 12:31:38 GMT
Subject: Re: select only one column, not the whole record
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-06 12:31:38 GMT
Sorry forgot something in my former post. See below
On Sun, Apr 6, 2008 at 2:29 PM, Frank Wagner <frank.wagner <at> nofusion.de> wrote:
this won´t include DISTINCT in the sql. this will:
results = conn.queryAll(conn.sqlrepr(Select(items=Yoursqlobject.q.column, distinct=True)))
Hi Daniel,
it will not be possible to achieve this with the regular SQLObject-classes. All you can do is something like this:
Yoursqlobject._connection.queryAll("select distinct ...") # hardcoded sql
or, to maintain more flexibility:
conn = Yoursqlobject._connection
conn.queryAll(conn.sqlrepr(Select(items=Yoursqlobject.q.column)))
this won´t include DISTINCT in the sql. this will:
results = conn.queryAll(conn.sqlrepr(Select(items=Yoursqlobject.q.column, distinct=True)))
HTH.
KR,
FrankOn Sun, Apr 6, 2008 at 7:55 AM, Daniel Fetchinson <fetchinson <at> googlemail.com> wrote:Hi folks,
Is it possible to select only 1 column out of a table and not the
whole record? More specifically, what I really need is the following:
SELECT DISTINCT column FROM table;
The point is that I only need DISTINCT values and if I can't select 1
column only then I can't use DISTINCT because generally full records
are never the same but the value in 'column' might be repeated. So I
would need to select everything and filter through the data in python
which would be a huge performance hit.
Cheers,
Daniel
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ sqlobject-discuss mailing list sqlobject-discuss <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
RSS Feed