Mjoin ->where always null
Mjoin ->where always null
json81
Posts: 24Questions: 6Answers: 1
Hi!
I have a working Mjoin. I would like to remove records with null-values. I have set "->where" under "->options" but no matter how I write, SQL will end up with "IS null".
Example:
->join(
Mjoin::inst( 'customer' )
->link( 'user.id_user', 'user_customer.id_user' )
->link( 'customer.id_customer', 'user_customer.id_customer' )
->order( 'company asc' )
->fields(
Field::inst( 'id_customer' )
->validator( Validate::required() )
->options( Options::inst()
->table( 'customer' )
->value( 'id_customer' )
->label( 'company' )
->where( 'company',null,'!=' )
),
Field::inst( 'company' )
)
)
**Debug: **
{"query":"SELECT DISTINCT id_customer
as 'id_customer', company
as 'company' FROM customer
WHERE company
IS NULL ","bindings":[]}
I guess I am doing something wrong. Any help would be much appreciated.
/Anders
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I am using Editor-1.9.2 and PHP server side.
I found this comment in my code:
//where clause MUST be a closure function in Options!!!
You'll probably also find it in the docs somewhere?!
Hi!
Thank you! I have tried it and it works.
Best Regards
Anders Jansson
You are welcome, Anders. You'll probably use "Options" more frequently. This post might be useful for you going forward.
https://datatables.net/forums/discussion/comment/116150/#Comment_116150
Roland