【问题标题】:What's wrong with this MYSQL DELETE statement?这个 MYSQL DELETE 语句有什么问题?
【发布时间】:2013-11-08 06:48:55
【问题描述】:

我想从大于某个 message_id 的表中删除记录。 我的删除语句似乎不起作用。

http://sqlfiddle.com/#!2/4f8ee/1

提前致谢

【问题讨论】:

  • 纠正你的小提琴DDL and DML statements are not allowed in the query panel for MySQL; only SELECT statements are allowed. Put DDL and DML in the schema panel.是错误

标签: mysql


【解决方案1】:
DELETE c
FROM `chat_history3` c
inner join 
(
   select message_id from `chat_history3` 
   where clan_id=4 
   ORDER BY message_id DESC 
   limit 30, 30000
) x
on c.`message_id` < x.`message_id` 

SQLFiddle demo

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    • 2012-01-14
    • 2011-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多