Re: [SQLObject] Multiple LeftJoinOns problems
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ber...@zk...> - 2007-06-28 08:48:17
|
> On Wed, Jun 27, 2007 at 03:04:26PM +0200, ber...@zk... wrot= e: > > SELECT object.id FROM object > > LEFT JOIN attribute attr1 ON ((object.id) =3D (attr1.object_id)), = object > > LEFT JOIN attribute attr2 ON ((object.id) =3D (attr2.object_id)) > > WHERE (((attr1.value) > (2.0)) AND ((attr2.value) < (5.0))) > > > > As you can see, there is a second ", object" before the second join= . Why is > > that? If I can tell correctly, this one is superfluous, right? Am I= doing > > something wrong (e.g. is it even allowed to pass a list of joins to= join?) > > or how can I do this correctly? > > The first parameter to a JOIN() can be None to avoid superfluous table: > > join =3D [ LEFTJOINOn(Object, attr1, Object.q.id =3D=3D attr1.q.obj= ectID) > , LEFTJOINOn(None, attr2, Object.q.id =3D=3D attr2.q.objec= tID) > ] > > Oleg. :-) Easy enough, thanks a lot! Bernhard ___________________________________________________________________ Disclaimer: Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger bestimm= t. Fuer den Fall, dass sie von nichtberechtigten Personen empfangen wird, bitten wir diese hoeflich, die Mitteilung an die ZKB zurueckzusenden un= d anschliessend die Mitteilung mit allen Anhaengen sowie allfaellige Kopi= en zu vernichten bzw. zu loeschen. Der Gebrauch der Information ist verbot= en. This message is intended only for the named recipient and may contain confidential or privileged information. If you have received it in error, please advise the sender by return e-= mail and delete this message and any attachments. Any unauthorised use or dissemination of this information is strictly prohibited.= |