如一个表list
id title cdate money
1 中国电子 2005-07-15 15.00
2 中国电子 2005-07-15 15.00
3 中国电子 2005-08-15 15.00
4 中国电子 2005-08-15 15.00
5 时代杂志 2004-07-13 10.00
6 时代杂志 2004-07-13 10.00
这些冗余数据我只想要一条!要怎么实现呢?
5 个解决方案
#1
分别留一条!!
#2
不是吧?没人帮忙?
#3
delete list where id not in (select max(id) from list group by id)
#4
可以说说什么意思咩?
#5
mysql4.1
delete from 表 where id not in (select min(id) from tmp2 group by title,cdate,money)
以前版本把子查询的结果先提出来,再执行delete
delete from 表 where id not in (select min(id) from tmp2 group by title,cdate,money)
以前版本把子查询的结果先提出来,再执行delete
#1
分别留一条!!
#2
不是吧?没人帮忙?
#3
delete list where id not in (select max(id) from list group by id)
#4
可以说说什么意思咩?
#5
mysql4.1
delete from 表 where id not in (select min(id) from tmp2 group by title,cdate,money)
以前版本把子查询的结果先提出来,再执行delete
delete from 表 where id not in (select min(id) from tmp2 group by title,cdate,money)
以前版本把子查询的结果先提出来,再执行delete