From: Luke O. <lu...@me...> - 2004-05-28 17:21:04
|
At one time I thought we had discussed the possibility of adding additional WHERE conditions to joins? Maybe something to consider anew. A little offtopic from Ian Sparks' example, but on one-to-many joins something like: aUser.timeOffRequests.select(TimeOffRequests.q.startDate > aDate) (only those requests after aDate for that user) and on many-to-many (eg Users<->Meetings): aUser.meetings.select(Meetings.q.organizer == aUser) (those meetings the user organized) (could also be directly a method of SO, aObj.joinNameWhere() or something. but I think I prefer it being a method of the join.) I'll take a look at the implementation if there's interest, I know it would have helped me in the past (instead of manually doing a select with the join column id). Looks like it may require beefing up joins though, along the lines of the SelectResults class. Thoughts? Quoting Ian Bicking <ia...@co...>: > Ian Sparks wrote: >> Before I start digging into the source code does the following >> ability already exist in SQLObject and, if not, does anyone else want >> it. >> >> AFAIK SQLObject can't do complex joins. For instance, I might want to >> do a query like : >> >> SELECT TimeOfRequests.* FROM TimeOffRequests INNER JOIN Users ON >> TimeOffRequests.cUserID = Users.cID WHERE Users.Dept = 12 > > Ah, and that is where you are wrong! > > TimeOffRequests.select(AND(TimeOffRequests.q.cUserID == Users.q.cID, > Users.q.Dept == 12)) > |