mysql MULTI DELETE错误

时间:2014-07-22 12:14:42

标签: mysql mariadb

我有mysql查询

DELETE data 
    FROM table 
        WHERE DATE_SUB(NOW(), INTERVAL 1 DAY) 
            AND status <> 0;

我得到了这个错误:

  

ERROR 1109(42S02)第2行:MULTI DELETE中的未知表'日期'

如何解决这个问题?

1 个答案:

答案 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;