如何从MYSQL中的表中删除冻结值

时间:2015-12-28 06:59:07

标签: mysql sql group-by sql-delete having

嗨我有一张桌子

DATE       VALUE            NAME
23MAY       156            CONSUMPTION_1
24MAY       122            CONSUMPTION_1
25MAY       122            COMSUMPTION_1
26MAY       122            CONSUMPTION_1
11APR       177            CONSUMPTION_2
12APR       199            CONSUMPTION_2
13APR       199            CONSUMPTION_2
14APR       199            CONSUMPTION_2
19SEP       318            CONSUMPTION_3
20SEP       282            CONSUMPTION_3
21SEP       183            CONSUMPTION_3

现在如何删除所有行的冷冻价值 即

DATE       VALUE            NAME
23MAY       156            CONSUMPTION_1
11APR       177            CONSUMPTION_2
19SEP       318            CONSUMPTION_3
20SEP       282            CONSUMPTION_3
21SEP       183            CONSUMPTION_3

提前发展

1 个答案:

答案 0 :(得分:0)

试试这个:

DELETE FROM MyTable 
GROUP BY value 
HAVING COUNT(*) > 1;