Thanks Mike, that works!

I really appreciate you taking the time to show me how to get this working.

Do you have an amazon wish list or something like that somewhere?


On Sep 30, 2013, at 2:09 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:

> qlast, qfirst = 'a', 'b'
> d = DBSession.query(Appl).\
>   distinct(Appl.refid).\
>   filter(Appl.lastname == qlast).\
>   filter(Appl.firstname == qfirst).\
>   group_by(Appl).\
>   order_by(Appl.refid)
> d = d.cte('distinct_query')
> 
> q = DBSession.query(Appl).select_entity_from(d).\
>    join(Appl.city).\
>    order_by(d.c.lastname, d.c.firstname)
> 
> for row in q:
>    print row.refid, row.firstname, row.lastname, row.city.name

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to