mysql 如何判断时间为空

问题:mysql 如何判断时间为空

解决方案

判断时间是否为空可以用isnull 函数判断。

select *, ISNULL(birthday),ISNULL(dtbirthday) from tablename;


select * from tablename where isnull(birthday)=true; //获取所有 birthday列 为空的行
//select * from tablename where birthday = null; //不能用该语句,否则获取为空

效果如图所示

mysql 如何判断时间为空