sql 表中删除字段重复的行
Posted wood132
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 表中删除字段重复的行相关的知识,希望对你有一定的参考价值。
Id Email UserName
1 [email protected] TaiseerJoudeh
2 [email protected] HasanAhmad
3 [email protected] MoatasemAhmad
4 [email protected] SalmaTamer
5 [email protected] AhmadRadi
6 [email protected] BillGates
7 [email protected] ShareefKhaled
8 [email protected] AramNaser
9 [email protected] LaylaIbrahim
10 [email protected] RemaOday
11 [email protected] FikriHusein
12 [email protected] ZakariHusein
13 [email protected] LaylaIbrahim
14 [email protected] TamerWesam
15 [email protected] KhaledHasaan
16 [email protected] AsaadIbrahim
17 [email protected] TareqNassar
18 [email protected] DianaLutfi
19 [email protected] TamaraMalek
20 [email protected] ArwaKamal
21 [email protected] SalmaTamer
22 [email protected] NisreenTamer
23 [email protected] SalmaTamer
去掉重复的UserName
delete Student2 where Id in
(
select id from (
select Id, UserName,ROW_NUMBER() over (partition by UserName order by id) orderid from Student2
)t1
where t1.orderid>1
)
以上是关于sql 表中删除字段重复的行的主要内容,如果未能解决你的问题,请参考以下文章