Re: [SQLObject] select with sum and join
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Martin B. <bl...@fu...> - 2005-12-30 03:52:21
|
Hi Olo I have a similar problem, wanting to use a single query to fetch stuff for an oft-visited web page from two tables at the same time, rather than doing a query and then having SQLObject doing another query for each row for objects on another table, due to a relation. I ended up re-using the SQLBuilder expression (it is built following a set of conditions by a few functions and it was more convenient to build the expression, rather than concat strings together), and then feeding that into a cursor, basically bypassing SQLObject. It works fine, but you'll have to decode the row by hand. Note: you need to convert the SQLBuilder expression with sqlrepr(). I suppose I'm not really providing an answer... On 12/28/05, Olo <jol...@o2...> wrote: > Hi > I use SQLObject and Postgres and I don't know how can I get query like: > > Select person.id, person.name, sum(invoice_position.amount) > from person join invoice on person.id =3D invoice.personID > join invoice_position on invoice.id invoice_position.invoiceI= D > where invoice.id =3D '1' > > in SQLObject. > > Thanks > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |