diff -r 310621cfed9b -r a9c641f6193b server/sources/rql2sql.py --- a/server/sources/rql2sql.py Tue Oct 20 16:22:52 2009 +0200 +++ b/server/sources/rql2sql.py Tue Oct 20 16:48:30 2009 +0200 @@ -212,6 +212,7 @@ if selectsortterms and sorts: sort_term_selection(sorts, selectedidx, rqlst, not needwrap and groups) if sorts and groups: + # when a query is grouped, ensure sort terms are grouped as well for sortterm in sorts: term = sortterm.term if not isinstance(term, Constant):