On Fri, May 04, 2007 at 03:38:34PM -0400, Thierry Lam wrote: > What if I also want to sort my query by group name, how should I do > that? Should I go the lower level Select() way? > > SELECT distinct name FROM user GROUP BY name
Please understand that SQLObject is a simple and mostly straightforward mapping between tables-classes, rows-instances and columns-attributes. Let see an example. class User(SQLObject): name = StringCol() We've just declared a table with two columns, integer autoincremented id and string name. We can now create instances of the class - that corresponds to inserting rows; we can select rows and an every row corresponds to a User instance. But a GROUP BY query returns rows with completely different columns. For example, the query SELECT name, COUNT(id) FROM user GROUP BY name returns name and count columns, but no id. To what User instances could SQLObject map these rows? To none. GROUP BY queries cannot be performed by the User class. sqlbuilder.Select() is the way to go for such queries. Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- 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 sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss