如何获取不使用默认DatePercentUpdate = 0000-00-00 00:00:00的时间戳的查询?我以为我使用0拥有了它,但是它捕获了注册00:00:00。
$stmtSummary = $mysqliSummary
->prepare("SELECT n.nodeID, n.percentRedYellow, n.count, c.Loopback_ip, c.city
FROM CATV.CableData c
INNER JOIN CATV.node n ON n.nodeID = c.Node_ID
INNER JOIN CATV.CM cm ON cm.LoopbackIP=c.Loopback_ip
WHERE c.LocationID IS NOT NULL
AND c.Status_Update_Time <= NOW()
AND c.Status_Update_Time >=(NOW() - INTERVAL 2 DAY)
AND c.Status_Update_Time>0
AND n.DatePercentUpdate <= NOW()
AND n.DatePercentUpdate >=(NOW() - INTERVAL 2 DAY)
AND n.DatePercentUpdate>0
AND length(c.Node_ID)>0
Group BY c.city, n.nodeID");
已添加:我尝试在线搜索以在查询中使用0000-00-00 00:00:00,但没有在过滤器中找到任何内容。
答案 0 :(得分:0)
您可以像这样简单地使用>
(大于)比较运算符或!=
(不等于)比较运算符
WHERE `date_field` != '0000-00-00 00:00:00'
该示例将获取日期不等于该值的所有行。
答案 1 :(得分:0)
捕获查询,其中时间戳为0000-00-00 00:00:00
选择行
select * from table_name where your_column = 0;
更新行
UPDATE table_name SET column_name = new_value where your_column = 0;
这将解决
mysql incorrect datetime value: '0000-00-00 00:00:00'
mysql错误
答案 2 :(得分:-3)
SELECT DATE_FORMAT(field_date, "0000-00-00 00:00:00");