I am using mysql function if. When I run SELECT IF(NULL, 2, 3) I get 3.
if
SELECT IF(NULL, 2, 3)
3
When the first parameter is NULL, by changing this SQL, can I get NULL?
Use IF() with ISNULL():
IF()
ISNULL()
SELECT IF(ISNULL(NULL), 2, 3) -- output is 2
Use
IF()
withISNULL()
: