left join two fields
left join two fields
ManuelWenner
Posts: 16Questions: 2Answers: 1
in DataTables
Hey together,
is it possible to execute a left join with two fields like the following?
leftJoin( 'sites', 'sites.id', '=', 'users.site' ) AND
leftJoin( 'sites', 'sites.id2', '=', 'users.id2' )
Thanks in advance
This discussion has been closed.
Answers
Hi,
Unfortunately no, not at this time, sorry. The best you can currently do is:
Regards,
Allan
Hey Allan,
thanks for your quick reply. So is it possible to do another query in the getFormatter function of a field? Something like:
Hey Allan,
i found a solution. Now i am using "$db->query('select')" inside the ->getFormatter function. That works great for me.
Keep on rockin. DataTables is awesome!
Greetings
Manuel
Hi Manuel,
Good to hear that works! One thing you should be aware of is that the query in
getFormatter
will be executed for every row in the table. Okay for small data sets, but not so good for large ones!Allan
So is it possible to do another query in the getFormatter function of a field?
Yes absolutely. As I noted above it does have the downside of being executed once for every row, so you need to be careful about using it.
Allan
@lissacoffey
Like mentioned above all you have to do (in my case) is inside getFormatter function