Hello everyone,

I have this and it works:

hwrepemails = session.query(Email).join(HWRep).all()

hwrepemailids = [ e.id for e in hwrepemails ]   

unassociatedusers = session.query(Email).filter(Email.projects == 
None).filter(not_(Email.id.in_(hwrepemailids))).order_by(Email.email).all()

The idea is to get all emails that have no projects, but to also exclude 
those emails that are associated with HWRep instances.

Since this way of doing it requires two queries, I was wondering if 
there is a way to do it in a single query?

Nothing comes to my mind in this regard, or I wouldn't ask here...

Regards,
mk

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