当前位置:网站首页>SQLserver加个判断
SQLserver加个判断
2022-08-10 01:39:00 【CSDN问答】
SELECT count(distinct lp.lot_number)as ELzs
FROM (SELECT lp.lot_number,lp.TransDate,lp.WorkorderId ,lp.device_number,
ROW_NUMBER() OVER( PARTITION BY lp.lot_number ORDER BY lp.TransDate)RN FROM Lot_Process lp)lp
WHERE RN=2 and (lp.WorkorderId like'PB%' or lp.WorkorderId like'DB%') and
lp.device_number in('M1-EL1-L1-01','M1-EL1-L1-02')
and lp.TransDate between convert(varchar(11),dateadd(day,-1,getdate()),120)+'08:00:00'
and convert(varchar(11),dateadd(day,-1,getdate()),120)+'19:59:59'
给帮忙加个判断,每天9点之前查询昨天8点到昨天20点,9点之后查询今天8点到今天20点。
边栏推荐
猜你喜欢
随机推荐
sqlmap dolog外带数据
FILE结构体在stdio.h头文件源码里的详细代码
以太网PHY芯片LAN8720A芯片研究
one of the variables needed for gradient computation has been modified by an inplace
多线程之自定义线程池
[LeetCode] Find the sum of the numbers from the root node to the leaf node
防勒索病毒现状分析
sql实战积累
ABAP 里文件操作涉及到中文字符集的问题和解决方案
已备案域名用国外服务器会不会掉备案?
力扣每日一题-第51天-744. 寻找比目标字母大的最小字母
Entity FrameWork Core教程,从基础应用到原理实战
微透镜阵列后光传播的研究
组件的使用
Experimental support for decorators may change in future releases.Set the "experimentalDecorators" option in "tsconfig" or "jsconfig" to remove this warning
SonarQube升级记录:7.8->7.9->8.9
阿里云OSS文件上传
Unity image使用长图后 图片很糊
unity 报错 Unsafe code may only appear if compiling with /unsafe. Enable “Allow ‘unsafe‘ code“ in Pla
不是吧,连公司里的卷王写代码都复制粘贴,这合理?