Equivalent of mysql IN operator
Equivalent of mysql IN operator
Is there a way to do a IN operator query on the server fields for example something like this:
$data->leftJoin( 'ad_agency_users', 'ad_agency_users.user_id', '=', 'users.user_id' )
->where( $key = 'ad_agency_users.ad_agency_id', $value = '18,19,20', $op = 'IN');
This discussion has been closed.
Replies
Yes, but you need to use a closure for the
where
method, rather than the simple form. For example:There are further details about this in my post here.
Writing up how to do conditions for Editor into proper manual pages is on my task list for tomorrow!
Out of interest, why did you put
$key =
etc in thewhere()
call. They are completely redundant, but I keep seeing it in questions, so I'm guessing it is coming from my documentation somewhere. Asking so I can fix it!Allan
Thank you. You just brought joy to my day. as it relates to the redundancy in the code above as asked, I am pretty sure I got that from another forum post when learning editor and always done it that way since.
Your code does work , I however have one more fix that i am asking of you. how do I provide a grouping on the outer query? From memory i am thinking this is not possible. In the docs i did see this : https://editor.datatables.net/docs/1.4.0/php/source-class-DataTables.Database.Query.html#574-589 but I am not able to get it to work.
here is what i have so far.
If it is not possible i could always fix it from the client side but just checking.
Grouping as in SQL
GROUP BY
? Currently, unfortunately that is not possible with the Editor libraries - they always expect to be editing a single row and group by can make that complex.Allan
Ok. I can easily remove duplicate records using this. I had already found a clientside solution: