Unfortunately, it's not implemented right now, and it seems that only 
Seans need it! See my post a little ways down this list about it. As it 
currently stands, someone like you or I is going to have to implement it 
and submit to the list before this kind of ordering is possible. 
(Believe me, I have about 5-8 queries right now that could really use it.)

I'm considering trying my hand at adding it but won't have time for at 
least a few more weeks due to my current project.

- Sean

Sean O'Donnell wrote:
> Hi There,
> 
> Im trying to figure out a way to order a query by the sum of a colum in 
> a MultipleJoin
> 
> e.g  (not the original code, its messed up by me trying so many possible 
> solutions :)
> 
> class Salesman(SQLObject):
>    name = StringCol()
>    sales = MultipleJoin(Sale)
> 
> class Sale(SQLObject):
>    salesman = ForeignKey('Salesman')
>    amount = IntCol()
> 
> 
> Now supposing I want to query a list of all of the Salesmen, ordered by 
> the Sum of the amounts of their sales?
> Will SQLObject let me do that?
> 
> If I was writing plain ole SQL I would do
> 
> select salesman.name, sum(sale.amount) from salesman, sale where 
> salesman.id = sale.salesman_id group by salesman.id order by sum(sale) 
> desc.
> 
> I dug through the SQLObject documentation and order by only seems to 
> take single column names, I found some references to group by on this 
> mailing list, but could not get anything working :(
> 
> Thanks for your help
> 
> Sean
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to