删除表中TimeStamp最小的位置

时间:2015-06-11 05:53:53

标签: mysql mysql-workbench

我想在我的表中删除行,其中我有最小的时间戳值。

DELETE FROM `table_name` WHERE `time_Stamp` =MIN(`table_name.time_Stamp`)

3 个答案:

答案 0 :(得分:0)

DELETE FROM table_name WHERE time_Stamp =(select MIN(a.time_Stamp) from table_name a)

答案 1 :(得分:0)

首先你做一个像

这样的选择语句
select * FROM table_name WHERE time_Stamp =(select MIN(table_name.time_Stamp) from table_name)

并检查您是否获得了所有正确的记录,然后您可以使用

DELETE FROM table_name WHERE time_Stamp =(select MIN(table_name.time_Stamp) from table_name)

答案 2 :(得分:0)

E.g:

DELETE x 
  FROM my_table x 
  JOIN 
     ( SELECT MIN(a) min_a FROM my_table ) y 
    ON y.min_a = x.a;