Product.select( AND(Product.q.id == ProductOption.q.productID, ProductOption.q.id == 2, Product.q.archived == 0))
On Thu, 3 Aug 2006, Ian Wilson wrote: > Hello SQLObject and friends, > If I have the two classes: > > class Product(InheritableSQLObject): > name = StringCol(length=255, alternateID=True) > description = StringCol() > archived = BoolCol(default=False) > options = RelatedJoin('ProductOption', orderBy="name") > > class ProductOption(SQLObject): > name = StringCol(alternateID=True, length=255) > archived = BoolCol(default=False) > products = RelatedJoin('Product', orderBy="name") > > I want to get all products that are not archived of a given product option. > > So how can I emulate this using a SQLBuilder and preferably without > mention of product_product_option? > > SELECT * FROM product, product_product_option WHERE product.id = > product_product_option.product_id AND > product_product_option.product_option_id = 2 AND product.archived = 0; > > > Thanks in advance, > -Ian > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > sqlobject-discuss mailing list > sqlobject-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss