Mysql 5.5 / phpmyadmin简单查询之谜

时间:2013-10-23 13:34:35

标签: mysql sql select phpmyadmin sql-delete

如果我在我的PhpMyAdmin(版本4.0.5)上运行此select - 查询:

(SELECT *
FROM prenotazione
WHERE stato = 'prenotato'
AND (to_days( data ) +2) < to_days( NOW( ) )
)

运行良好。

但是,如果我运行delete - 查询不起作用:

(DELETE *
FROM prenotazione
WHERE stato = 'prenotato'
AND (to_days( data ) +2) < to_days( NOW( ) )
)

有人请解释一下,为什么会这样。

3 个答案:

答案 0 :(得分:4)

只是

DELETE FROM ...

不是

DELETE * FROM ...
      ^^^

有关详细信息,请参阅DELETE Syntax

答案 1 :(得分:1)

进行如下查询:

(DELETE FROM prenotazione WHERE stato = 'prenotato' AND (to_days( data ) +2) < to_days( NOW( ) ) )

有关详细信息,请检查删除语法manual

答案 2 :(得分:0)

这项工作在查询之前和之后没有*和括号

DELETE
FROM prenotazione
WHERE stato = 'prenotato'
AND (to_days( data ) +2) < to_days( NOW( ) )