Hi all, I'm trying to work with many-to-many relationships and don't quite know how to do the following so that the query translates to a single SQL query:
There are zoos, each zoo has cages, each cage has animals, and both animals and cages have one or more properties. A property may belong to one or more cage and/or animal (so a property can be shared between animals and cages). I need to select all properties for a given zoo. So this is what I have: class zoo( SQLObject ): cages = MultipleJoin( 'cage' ) class cage( SQLObject ): zoo = ForeignKey( 'zoo' ) animals = MultipleJoin( 'animal' ) properties = RelatedJoin( 'property' ) class animal( SQLObject ): cage = ForeignKey( 'cage' ) properties = RelatedJoin( 'property' ) class property( SQLObject ): animals = RelatedJoin( 'animal' ) cages = RelatedJoin( 'cage' ) First of all, is the above layout a good idea for my situation? What would be the select call for selecting all properties for a given zoo instance? Yes, I know these are pretty basic things but since I'm not really well-versed in SQL it's no surprise that I'm not really well-versed in SQLObject either so please bear with me. Thanks a million, Daniel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss