3461 Posts in 1065 Topics by 740 members
|Go to End|
25 March 2014 at 2:53am
Hi i am searching on a nullable has_one relation.
What is the solution to realize it?
29 March 2014 at 2:01am
anybody an idea?
2 April 2014 at 4:33am
AFAIK the has_one Relationship will populated with 0, not NULL.
But if you want to identify this with SQL, specifically MySQL, you can use...
SELECT * FROM MyTable WHERE MyField IS NULL;
SELECT * FROM MyTable WHERE COALESCE(MyField,0) = 0
(COALESCE means it goes through all param left to right and returns the first param that is NOT NULL)
|Go to Top|