Stu.Axon wrote:
>
> I'm having another go at converting some sql to sqlalchemy:
>
>      select
>             count(distinct build.device_id)
>         from
>             channelbuild
>         join
>             build
>         on
>             build.id = channelbuild.build_id
>         where
>             channelbuild.channel_id = 9
>         and not
>             build.in_icp"""
>
> I've got this far:
>
> build = db.build
> channelbuild = db.channelbuild
>
> channelbuild\
>     .join((build, build.id == channelbuild.build_id))\
>     .filter(channelbuild.channel_id == 9)\
>     .filter(build.in_icp == False)\
>     .count()

try query(func.count(distinct(build.device_id))).filter(...).scalar()



--~--~---------~--~----~------------~-------~--~----~
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