Hi i am searching on a nullable has_one relation.
What is the solution to realize it?
Thank you.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi i am searching on a nullable has_one relation.
What is the solution to realize it?
Thank you.
anybody an idea?
Hi melatonin,
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;
OR
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)