SQL 删除列中的重复值
D name
13 张三
1123 张三
15 李四
17 李四
我要得到的结果是
ID name
13 张三
15 李四
请问要怎么写
问题补充:删除重复的
在线等啊
请问具体的语法要怎么写啊???????
在线等啊
请问具体的语法要怎么写啊???????
=====================================================
delete from 表
where id not in(select min(id) from 表 group by name ) //删除重复名字的记录
删除之前请用语句
select *
from 表
where id in(select min(id) from 表 group by name )
查看能保留下来的数据。
where id not in(select min(id) from 表 group by name ) //删除重复名字的记录
删除之前请用语句
select *
from 表
where id in(select min(id) from 表 group by name )
查看能保留下来的数据。
eg.delete from T_bbs_subject
where subjectId not in(select min(subjectId) from T_bbs_subject group by clsid )
where subjectId not in(select min(subjectId) from T_bbs_subject group by clsid )