use book

go

create table ##T1(

n int,

a nvarchar(20)

)

--查詢重複記錄,插入臨時表

insert into ##T1(n,a)

select suid,WorkID from HR_Duty_EmpSchedule_M

where WorkID in (select WorkID  from HR_Duty_EmpSchedule_M  group by WorkID having count(WorkID) > 1)

and DutyDate ='2018/11/26'

order by WorkID

select * from ##T1

create table ##T2(

m int,

a nvarchar(20)

)

--查詢

select min(n) as N  from ##T1 group by a having count(a)>1

insert into ##T2(m,a)

select n,a from ##T1 where n not in ( select min(n) as N  from ##T1 group by a having count(a)>1)

select * from ##T2

select * from HR_Duty_EmpSchedule_M X,##T2 Y  where X.SUID=Y.m order by WorkID

--delete from HR_Duty_EmpSchedule_M  where SUID in (select m from ##T2)

drop table ##T1

drop table ##T2

最新文章

  1. memcache and redis 的区别
  2. JAVA 如何把request请求的参数,快速放到model对象中
  3. 【JSP手记】--jsp里面session.getAttribute("×××")在java中的表示
  4. MVC5-11 浅谈拦截器
  5. 从0到1---“保多多”APP的开发(二)
  6. 编程语言 IDE 对比
  7. stream转byte数组几种方式
  8. 完美解决VMware Workstation : Could not open /dev/vmmon: No such file or directory
  9. onmousedown活用之鼠标拖动
  10. 海思Hi3559A/CV100 DDR4驱动配置手册
  11. [翻译 EF Core in Action] 1.5 关于NoSql
  12. work-7.2
  13. linux jpg文件查找木马
  14. 配置3层交换机VLAN间通信
  15. Java学习笔记之——Manth类和String类
  16. VirtualBox下扩容vdi文件
  17. 静态代码检查findbugs/阿里巴巴开发规范
  18. numpy广播
  19. spring 解耦
  20. Graph

热门文章

  1. OpenGL ES: (5) OpenGL的基本概念、OpenGL ES 在屏幕产生图片的过程、OpenGL管线(pipeline)
  2. 002 centos7中遇到的问题
  3. Docs-.NET-C#-指南-语言参考-关键字-值类型:可以 null 的值类型
  4. spring boot集成Websocket
  5. 【427】Graph 实现 以及 DFS & BFS
  6. Linux使用sleep进行延迟实验
  7. 【Leetcode_easy】941. Valid Mountain Array
  8. shell每隔一秒钟就记录下netstat状态
  9. Redis概述与基本操作
  10. BASH输出着色显示