Re: [SQLObject] Selecting from RelatedJoin
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Jim S. <ji...@ql...> - 2007-06-20 16:26:10
|
Oleg: Thanks for this. It works just as I'd hoped. Just had to change the Contact.q.contactId to Contact.q.id. -Jim Oleg Broytmann wrote: > On Wed, Jun 20, 2007 at 10:42:21AM -0500, Jim Steil wrote: > >> SELECT * FROM contact WHERE contactId IN (SELECT contactId FROM >> contactCategory WHERE categoryId IN (1,3)) >> > > from sqlobject.sqlbuilder import IN, Select > Contact.select(IN(Contact.q.contactId, > Select([ContactCategory.q.contactId], IN(ContactCategory.q.categoryId, [1,3])))) > > PS. Yes, SQLBuilder can distinguish these two IN()s automagically. > > Oleg. > |