我当前的查询字符串是
$var = ' fkMemberId = \'24\' AND month(DisallowTimeFrom) = \'10\' ';
毋庸置疑,如果表中没有十月,那么我得到一个空的结果。
我想要实现的目标是......
$var = ' fkMemberId = \'24\' BUT MAY ALSO CONTAIN BUT IF NULL CONTINUE QUERY month(DisallowTimeFrom) = \'10\' ';
fkMemberId = \ '24 \'必须
月(DisallowTimeFrom)= \''\'\ n \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n <
为了简洁,我遗漏了其余的查询。
答案 0 :(得分:0)
$var = ' fkMemberId = \'24\' AND (DisallowTimeFrom IS NULL OR month(DisallowTimeFrom) = \'10\') ';