On Wed, Aug 12, 2009 at 12:36 PM, Miguel Tavares<migtava...@gmail.com> wrote: > Hi Oleg! > > A second intermediate table can be used to state a second many-to-many > relationship and it might make more sense to have it in reverse > order. > > Imagine this scenario: > > class Address(SQLObject): > Address = sqlobject.StringCol () > People = sqlobject.RelatedJoin ('Person') > > class Person(SQLObject): > Name = sqlobject.StringCol () > Addresses = sqlobject.RelatedJoin ('Address') > > So a Person can have several addresses (House, Work, Beach House, etc) > and each Address can be for several Persons (all the member of the > family for example). > > Does this makes any sense?
With this example, you'll create an intermediate table which looks something like: id1 : idPerson1 : idAddress1 id2 : idPerson1 : idAddress2 id3 : idPerson2 : idAddress1 id4 : idPerson2 : idAddress3 etc. where idPerson & idAddress are the identifiers for the respective entries in the Person and Address tables [1]. This captures the entire relationship - selecting entries based on the address will give you all the Person records, and selecting on the Person will give you all the address records. I'm not seeing why you think you need multiple intermediate tables? [1] I've swapped the order of the two columns from how sqlobject will actually create the table, but that doesn't really matter. -- Neil Muller drnlmul...@gmail.com I've got a gmail account. Why haven't I become cool? ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss