健康一贴灵,专注医药行业管理信息化

爱喜 常用SQL

 

select * from X_Task where TaskName ='A20211207-4'     --1896  --1897  --1902  --1909    --1912   --1905   -1909   ----A202111207-4   和1905的任务是强制结束的
   
select * from X_task where BatchNo=210723
select * from X_task where TaskName='E20211207-1'

update X_Task set Flag=3 where ID=1879

---update X_Task set Flag = 4  where ID=1909   -----数据库强制结束任务

--update X_Task set Flag = 3  where  flag = 2 and id = 1904  -----数据库强制暂停任务

select packcode, count(*)/200 from X_packcodeinfo where taskid=1909  and LevelNo=1 group by PackCode
select  ParentCode, count(*) from X_packcodeinfo where taskid=1909 and LevelNo=2  group by ParentCode
select count(*) from X_packcodeinfo where taskid=1905 and LevelNo=3

select * from (select Packcode from X_packcodeinfo where LevelNo=2 and taskid=1909)t where t.PackCode not in (select ParentCode from X_packcodeinfo where taskid=1909 and LevelNo=1 group by ParentCode)
select * from (select ParentCode from X_packcodeinfo where taskid=1909 and LevelNo=1 group by ParentCode) t where t.ParentCode not in (select Packcode from X_packcodeinfo where LevelNo=2 and taskid=1909)


select * from x_packcodeinfo where TaskID=1909 and ParentCode is null and LevelNo=1

select * from X_packcodeinfo where packcode='87862020000480161384'
select * from X_packcodeinfo where ParentCode='87862020000480161384'

select * from X_packcodeinfo where packcode='83747650102822392260'
select * from X_packcodeinfo where PackCode='83747650101802966913'

select COUNT(*) from X_PackCodeInfo where ProID=240 and PackageRuleID=486 and LevelNo=1  and Flag=5

 

posted @ 2023-07-21 08:33  一贴灵  阅读(20)  评论(2编辑  收藏  举报
学以致用,效率第一