How to setup join relation with AND clause on a JOIN?

48 views
Skip to first unread message

Blastiko

unread,
Feb 27, 2022, 8:18:36 AM2/27/22
to CFWheels
Hi all.

In model cfc, how can i setup a relation like this?
SELECT tt.id
FROM tTable tt
LEFT JOIN aTable at ON at.fk_id = tt.id AND at.active = 1

In aTable.cfc model i can write this:
hasMany(name="rel_name", modelName="tTable", foreingKey="fk_id", joinType="outer");

but how can i setup the last part: "... AND at.active = 1" ?

Thanks

Tom King

unread,
Feb 28, 2022, 3:05:40 PM2/28/22
to CFWheels
Not sure wheels deals wheel with table aliases.
But you should be able to do it without?  
T

Blastiko

unread,
Mar 1, 2022, 8:52:27 AM3/1/22
to CFWheels
Hi Tom
Yeah, i used workaround, less elegant and more expensive but works.
Thanks.
Reply all
Reply to author
Forward
0 new messages