On Jun 27, 2007, at 7:34 PM, voltron wrote:

>
> Could you point me to the url where this example is? I wonder why
> order_by and other things work with the ORM then and group_by left out
>

also you need to understand the behavior of group by, as far as SQL.   
postgres in particular, as well as oracle, are very strict about it;  
whereas MySQL is not, hence different people are getting different  
results with it.

the "official" behavior of GROUP BY in SQL is that it is applied to  
SELECT statements which contain "aggregate" functions in their  
columns clause, such as count(), max(), sum(), etc.  however, it  
specifically must be applied to all other columns in the columns  
clause that are *not* aggregates, such as:

select a, b, c, max(d) from table

requires that a, b, c be stated in the GROUP BY clause:

select a, b, c, max(d) from table group by a, b, c

on the other hand the aggregate functions such as max(d) can be  
listed in the HAVING clause:

select a, b, c, max(d) from table group by a, b, c having max(d)=10

the specific error youre getting is raised by postgres, and is noting  
this requirement.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to