JIM51
  • Home
  • Archives
Word of Forks
Home Archives

SQL 刪除重複資料

Apr 24, 2018
TSQL

有時整理SQL資料時需要刪除重覆資料,在這裡做個筆記。

1
2
3
4
5
6
7
8
set rowcount 1
WHILE 1=1
begin
delete from table where id in(select id from table group by id having count(*)>1)
if @@rowcount=0
break
end
set rowcount 0
TSQL
prev: 網路斷線情況下遠端(RDP)登入緩慢 next: Windows 10 試用版 延長試用
Categories
  • Docker
    4
  • Hexo
    4
  • Kubernetes
    3
  • Linux
    2
  • Office
    1
  • TSQL
    1
  • Tools
    2
  • Windows
    5
  • Woocommerce
    1
  • Wordpress
    2
Tags
Docker Hexo Kubernetes Linux NginX Office SSL TSQL Tools Windows Wordpress Wordpress,Woocommerce
Theme MaterialFlow designed by Kevin Tan.