我有mysql查询
DELETE data
FROM table
WHERE DATE_SUB(NOW(), INTERVAL 1 DAY)
AND status <> 0;
我得到了这个错误:
ERROR 1109(42S02)第2行:MULTI DELETE中的未知表'日期'
如何解决这个问题?
答案 0 :(得分:1)
data
未定义。您可以使用别名或完全删除它:
DELETE t
FROM table t
WHERE DATE_SUB(NOW(), INTERVAL 1 DAY) AND status <> 0;
或者只是尝试:
DELETE FROM data
WHERE DATE_SUB(NOW(), INTERVAL 1 DAY) AND status <> 0;