session.query(Invoice.user_name, 
Item).join(Invoice.item).distinct().from_self(Invoice.user_name, 
func.count(1)).group_by(Invoice.user_name)



On Jan 20, 2011, at 11:45 AM, NiL wrote:

> thanks again
> 
> but the unicity of Item is guaranteed by the triplet of PK
> 
> I can't just discriminate the distinct() based on the item_id only (it
> is not unique by itself in my set of data)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to