0
在以下示例中,我获取了大于'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)
你尝试过或 “OR” 更大? – sheeks06 2010-09-08 07:04:03
你能否澄清你的问题?你想要返回1)无效(零)和空日期? 2)选择'正确'的日期大于'2009-11-29' – 2010-09-08 07:11:14
我正在寻找“或”。有时候事情很简单,在你眼前,你仍然看不到它们! – shantanuo 2010-09-08 07:25:56