永发信息网

求解SQL 如何多条件筛选?

答案:1  悬赏:40  手机版
解决时间 2021-11-29 22:01
  • 提问者网友:骑士
  • 2021-11-29 19:11
求解SQL 如何多条件筛选?
最佳答案
  • 五星知识达人网友:刀戟声无边
  • 2021-11-29 20:07
试试:
select A.storets as sjstorets, A.processts, A.wafer, A.row, A.col, A.htnum, A.statnum, A.site, A.op as opnum,
A.jobnum, A.carrier, A.employee, A.ec as fabec, a.sh as PreFCLSH,
(case when A.htnum in (42,47) then (A.SH>0.7 and A.sh<1.5),
when A.htnum in (43) then (A.SH>0.55 and A.sh<1.3),
when A.htnum in (44) then (A.SH>0.5 and A.sh<1.3),
when A.htnum in (45) then (A.SH>1.1 and A.sh<2.0),
when A.htnum in (46) then (A.SH>0.4 and A.sh<1.0),
when A.htnum in (39.40.41) then (A.SH>0.7 and A.sh<1.5)
end)
from FAB.OP2365 A where A.op=8365 and A.site='SZ'
order by A.wafer,A.row,A.col追答按照你的要求,用case实现不了,你还是用union吧
select A.storets as sjstorets, A.processts, A.wafer, A.row, A.col, A.htnum, A.statnum, A.site, A.op as opnum,
A.jobnum, A.carrier, A.employee, A.ec as fabec, a.sh as PreFCLSH from FAB.OP2365 A where A.op=8365 and A.site='SZ'
and A.htnum in (42,47) and (A.SH>0.7 and A.sh<1.5) order by A.wafer,A.row,A.col
union
select A.storets as sjstorets, A.processts, A.wafer, A.row, A.col, A.htnum, A.statnum, A.site, A.op as opnum,
A.jobnum, A.carrier, A.employee, A.ec as fabec, a.sh as PreFCLSH from FAB.OP2365 A where A.op=8365 and A.site='SZ'
and A.htnum in (43) and (A.SH>0.55 and A.sh<1.3) order by A.wafer,A.row,A.col
union
.....
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯