from sqlalchemy import func, distinct
query(Invoice.user_name,
func.count(distinct(Item.id))).join(Invoice.items).group_by(Invoice.user_name)
On Jan 20, 2011, at 9:51 AM, NiL wrote:
Hi Michael,
thank you very much for your prompt answer.
What I want to achieve is, counting the number
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