7 个解决方案
#1
大家出出主意啊
#2
DISTINCT ..
#3
但我要取出重复的记录啊
#4
什么叫排重?
#5
是这样的,我要删除数据库中一指定字段值相同的多余记录,但要一条在数据库中
#6
用这个语句试试看:
f0代表指定的某字段
delete from TableName where f0 in(select max(f0) from TableName group by f0 having count(f0)>1)
f0代表指定的某字段
delete from TableName where f0 in(select max(f0) from TableName group by f0 having count(f0)>1)
#7
不好意思,上面的有错误。
ID代表自增长字段
f1代表指定的某字段
delete from TableName where ID in(select max(ID) from TableName group by f1 having count(ID)>1)
ID代表自增长字段
f1代表指定的某字段
delete from TableName where ID in(select max(ID) from TableName group by f1 having count(ID)>1)
#1
大家出出主意啊
#2
DISTINCT ..
#3
但我要取出重复的记录啊
#4
什么叫排重?
#5
是这样的,我要删除数据库中一指定字段值相同的多余记录,但要一条在数据库中
#6
用这个语句试试看:
f0代表指定的某字段
delete from TableName where f0 in(select max(f0) from TableName group by f0 having count(f0)>1)
f0代表指定的某字段
delete from TableName where f0 in(select max(f0) from TableName group by f0 having count(f0)>1)
#7
不好意思,上面的有错误。
ID代表自增长字段
f1代表指定的某字段
delete from TableName where ID in(select max(ID) from TableName group by f1 having count(ID)>1)
ID代表自增长字段
f1代表指定的某字段
delete from TableName where ID in(select max(ID) from TableName group by f1 having count(ID)>1)