在读取日期范围后创建多个选择

时间:2019-01-09 11:46:48

标签: sql oracle visual-studio

我编写了一个计算子字符串的代码。 (在帮助下)

select sum(case when cod_ordem_producao like 'LQX%' then 1 else 0 end) as lqx,
   sum(case when cod_ordem_producao like 'LQT%' or cod_ordem_producao like'LQRT%' then 1 else 0 end) as "LQT/LQRT",
   sum(case when cod_ordem_producao like 'LQZ%' or cod_ordem_producao like'LQRZ%' then 1 else 0 end) as "LQZ/LQRZ",
   sum(case when cod_ordem_producao like 'LQW%' or cod_ordem_producao like'LQRW%' then 1 else 0 end) as "LQW/LQRW",
   sum(case when cod_ordem_producao like 'LQ%' then 1 else 0 end) as Lq,
   sum(case when cod_ordem_producao like 'LQR%' then 1 else 0 end) as LQR
from QT_QTS.RES_TUBO_REVENIMENTO2 res
where res.DTH_CRIACAO_REG >= :dthini 
and res.DTH_CRIACAO_REG <=:dthfim

现在,我需要包括一个读取日期范围并显示该子字符串选项的选项,以供用户选择。

例如:

dthini = 01/01/2019
dthfim = 08/01/2019

选择:LQX,LQT,LQZ ...

因此,该代码根据此日期范围内的结果为用户显示结果。

软件:BIS报告-Microsoft Visual Studio

0 个答案:

没有答案