SQL 删除列中的重复值

来源:百度知道 编辑:UC知道 时间:2024/06/25 16:45:20
ID 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 )
查看能保留下来的数据。

select distinct ............

可以把不重复的记录选出来into table

就是把查询结果生成一个新表

select distinct id,name from tablename

是要显示出来不重复还是删除表里面的重复的?