I'm having trouble envisaging how to implement some basic many-to-many features; ones that would be trivial with a couple of INNER JOINs in normal SQL but which are baffling me in SQLObject.
My basic structure is as follows (cut down from a full TurboGears application): class User(SQLObject): skills = MultipleJoin("Skill", joinColumn="user_id") ... etc ... class Skill(SQLObject): """An instance of a skill that a particular user claims to have.""" user = ForeignKey("User") stype = ForeignKey("Skilltype") competence = IntCol() class Skilltype(SQLObject): """A type of skill, which can be held by many users, to different degrees of competence""" name = UnicodeCol(length=255) ...etc.... The Skill table links the User table to the Skilltype table. I can't use an implicit intermediate table as I need access to the 'competence' column, and may add other columns later. The "How can I define my own intermediate table in my Many-to-Many relationship?" entry in the docs looks vaguely like what I might need, but it gives no examples of how to use the resulting objects. So, how would I implement queries like the following? # All User 1's skills where competence > 3 SELECT * from User INNER JOIN Skill USING (user_id) INNER JOIN Skilltype USING (stype_id) WHERE user_id = 1 AND Skilltype.competence > 3 Or... # All users who have the Skill "xyz" SELECT * from User INNER JOIN Skill USING (user_id) INNER JOIN Skilltype USING (stype_id) WHERE Skilltype = "xyz" GROUP BY User -- Ben Sizer ------------------------------------------------------------------------- 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