我有这个问题:
select
case when EventCategory < 0.05 Then 'NOT INCL' ELSE 'OK' END AS Under3Min
from
(
Select
Sum(case when CustomEvent = 'without Stop' then cast(EventEndDateTime - EventStartDateTime as float)*24 else 0 end) as EventCategory
FROM tDataCategory
在这个查询中,我从表CustomEvent中取出`without Stop'并取这个持续时间的总和。在第一个选择中,我说如果EventCategory小于0.05,那么它不应该包含其他包含。 这给了我正确的输出。但我想在输出中排除“不包括”完整。 如何排除此问题?
答案 0 :(得分:2)
添加Where条件,
select
CustomEvent,
case when EventCategory < 0.05 Then 'NOT INCL' ELSE 'OK' END AS Under3Min
from
(
Select
CustomEvent,
Sum(case when CustomEvent = 'without Stop' then cast(EventEndDateTime - EventStartDateTime as float)*24 else 0 end) as EventCategory
FROM tDataCategory
GROUP BY CustomEvent
) x
WHERE CustomEvent <> 'without Stop'
OR (CustomEvent = 'without Stop' AND x.EventCategory >=0.05)
答案 1 :(得分:0)
process (clk) is
begin
if rst='0' then
q < = "000000001";
elsif rising_edge(clk) then
q <= d;
end if;
end process;