|
From: Ian B. <ia...@co...> - 2004-05-28 16:21:29
|
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))
You can also do:
TimeOffRequests.select("TimeOffRequests.cUserID = Users.cID AND
Users.Dept = 12", clauseTables=['Users'])
I imagine there are probably more complex queries that won't work, but
one at a time...
Ian
|