Home >Database >Mysql Tutorial >删除user表(含字段id和字段name)中重复的name字段,保留唯一的

删除user表(含字段id和字段name)中重复的name字段,保留唯一的

WBOY
WBOYOriginal
2016-06-07 14:57:091500browse

这个是我在一次面试中碰到的Oracle笔试题,但当时没做出来,回来后就过研究做出来了。把代码贴出来,分享给大家,希望对跟我一样在求职中的有用。 无 delete from user where id not in(select min(id) from user group by name);

这个是我在一次面试中碰到的Oracle笔试题,但当时没做出来,回来后就过研究做出来了。把代码贴出来,分享给大家,希望对跟我一样在求职中的有用。
delete from user where id not in(select min(id) from user group by name);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn