Mysql 选择无效日期

Mysql 选择无效日期,mysql,Mysql,在下面的示例中,我得到的所有值都大于'2009-11-29'以及NULL和'0000-00-00'。有没有其他方法可以得到同样的结果 mysql>select * from totest; +---------------------+ | stime | +---------------------+ | 0000-00-00 00:00:00 | | 2009-12-12 12:22:32 | | 0000-00-00 00:00:00 | | 200

在下面的示例中,我得到的所有值都大于'2009-11-29'以及NULL和'0000-00-00'。有没有其他方法可以得到同样的结果

mysql>select * from totest;
+---------------------+
| stime               |
+---------------------+
| 0000-00-00 00:00:00 | 
| 2009-12-12 12:22:32 | 
| 0000-00-00 00:00:00 | 
| 2009-01-12 12:22:32 | 
| 0000-00-00 00:00:00 | 
| NULL                | 
+---------------------+
6 rows in set (0.00 sec)

mysql>select * from totest where If(stime!='0000-00-00', stime >= '2009-11-29', 1);
+---------------------+
| stime               |
+---------------------+
| 0000-00-00 00:00:00 | 
| 2009-12-12 12:22:32 | 
| 0000-00-00 00:00:00 | 
| 0000-00-00 00:00:00 | 
| NULL                | 
+---------------------+
5 rows in set (0.00 sec)
你能试试这个吗

select *
from totest
where 
    stime = '0000-00-00'
    OR stime IS NULL
    OR stime < '2009-11-29'
选择*
来自图斯特
哪里
时间='0000-00-00'
或者stime为空
或时间<'2009-11-29'
选择无效日期(零日期和空日期)

仅选择大于“2009-11-29”的有效日期

      select * from totest 
      where stime != '0000-00-00' 
        AND stime IS NULL
        AND stime >= '2009-11-29'

你试过或“或”了吗?请你澄清一下你的问题?您想要返回什么1)无效(零)和空日期?2) 选择大于“2009-11-29”的“正确”日期,我正在寻找“或”。有时候事情很简单,就在你眼前,你仍然看不见它们!
      select * from totest 
      where stime != '0000-00-00' 
        AND stime IS NULL
        AND stime >= '2009-11-29'