惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
N
News and Events Feed by Topic
T
Tor Project blog
AI
AI
S
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hacker News: Ask HN
Hacker News: Ask HN
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
B
Blog
G
GRAHAM CLULEY
Recent Commits to openclaw:main
Recent Commits to openclaw:main
W
WeLiveSecurity
GbyAI
GbyAI
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Check Point Blog
SecWiki News
SecWiki News
Y
Y Combinator Blog
I
Intezer
S
Securelist
WordPress大学
WordPress大学
小众软件
小众软件
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
Schneier on Security
Schneier on Security
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
P
Privacy International News Feed
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threatpost
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
Forbes - Security
Forbes - Security
C
Cisco Blogs
The GitHub Blog
The GitHub Blog
博客园 - 司徒正美

博客园 - 冯小磊

女人的面相 只有mdf文件的恢复技术 冒泡,选择,插入,希尔 vb.net c#.net 代码相互转换 [转]C# 参考之转换关键字:operator、explicit与implicit 【转载】SQL查询中区分大小写的方法 Dev里面DataGid控件使用方法之一 (word导出问题)解决:服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT))的解决方法 白骨精写给孙悟空的绝世情书 DBCC CHECKDB (检查指定数据库中的所有对象的分配和结构完整性) c# 限制窗体 sqlserver附加数据库错误823的解决方案 改变DevExpress控件的字体 按某一字段分组取最大(小)值所在行的数据 mssql1069错误(由于登录失败而无法启动服务)解决方法 C# 判断中文字符(字符串) 函数datediff MSSQL中取字符中的汉字或双字节字符 用SqlCommandBuilder 实现批量更新
对于sql数据库中重复的记录...
冯小磊 · 2008-07-08 · via 博客园 - 冯小磊

--刪除重復列   
  a.如果有ID字段,就是具有唯一性的字段   
    
  delect   
table   where   id   not   in   (   
    
  
select   max(id)   from   table   group   by   col1,col2,col3   
  )   
  
group   by   子句后跟的字段就是你用到判斷重复的字段   
    
    
    
  b.,如果是判斷所有字段   
  
select   *   into   #aa   from   table   group   by   id1,id2,.   
  
delete   table   table     
  
insert   into   table     
  
select   *   from   #aa   
    
    
    
  c.如果表中有ID的情況   
    
  
select   identity(int,1,1)   as   id,*   into   #temp   from   tabel   
  delect   #   
where   id   not   in   (   
  
select   max(id)   from   #   group   by   col1,col2,col3)   
  delect   
table   
  inset   
into   table()   
  
select   ..   from   #temp   
    
    
  col1
+','+col2+','col5   組合主鍵   
    
    
  
select   *   from   table   where   col1+','+col2+','col5   in   (   
    
  
select   max(col1+','+col2+','col5)   from   table     
  
where   having   count(*)>1   
  
group   by   col1,col2,col3,col4     
  )   
  
group   by   子句后跟的字段就是你用到判斷重复的字段   
    
  d.   
  
select   identity(int,1,1)   as   id,*   into   #temp   from   tabel   
  
select   *   from   #temp   where   id   in   (   
  
select   max(id)   from   #emp   where   having   count(*)>1   group   by   col1,col2,col3)   
    
  e.   
  
alter   table   yourtable   add   rownum   int   identity(1,1)   
  
go   
  
delete   from   yourtable   where   rownum   not   in   (select   min(rownum   )   from   yourtable   group   by   你重复的字段名)   
  
go   
  
alter   table   yourtable   drop   column   rownum   
  
go   
    
  f.   
  
alter   table   表   add   newfield   int   identity(1,1)   
  
delete   表   
  
where   newfield   not   in(   
  
select   min(newfield)   from   表   group   by   除newfield外的所有字段   
  )   
    
  
alter   table   表   drop   column   newfield   
    
    
  g.   
  
--   刪除表中重復的記錄   
  DELETE   delete1   
  
FROM   tabTest   delete1   
  
JOIN   tabTest   delete2     
  
ON   delete1.student_id=delete2.student_id   AND   delete1.course_id=delete2.course_id   AND   delete1.id>delete2.id