我遇到count函数的问题,其中count函数返回空值
我有四张桌子
我遇到了count函数的问题。这是我的代码的一部分
create temp table Testing_table as
select event_log.[ruid] as ruid, event_log.[raw_value] as raw_value, event_log.[event_id] as event_id, event_log.[timestamp] as timestamp, count ('Test_ID') as 'Test_ID', null as 'Test Result'
from event_log
JOIN controls
on event_log.[ruid] = controls.[ruid]
and event_log.[raw_value] = controls.[raw_value]
UNION
select
ruid, raw_value, event_id, timestamp, null as 'Test_ID',
CASE
when raw_value = 0.9343453535635 then 'Pass'
when raw_value = 0.04583743847 then 'Pass'
when raw_value = 0.563363656757 then 'Pass'
when raw_value = 0.6666666666 then 'Pass'
when raw_value = 0.65757447777 then 'Pass'
when raw_value = 0.9267482727372 then 'Pass'
when raw_value = 0.2323239945454 then 'Pass'
when raw_value = 0.9732746367437 then 'Pass'
when raw_value = 0.0222222222222 then 'Pass'
when raw_value = 0.5656857676747 then 'Pass'
when raw_value = 0.6546456363563 then 'Pass'
when raw_value = 0.0348343874738 then 'Pass'
when raw_value = 0.9457458745737 then 'Pass'
when raw_value = 0.543452434345 then 'Pass'
when raw_value = 0.9836438454522 then 'Pass'
when raw_value = 0.2546456745635 then 'Pass'
when raw_value = 0.0456474635353 then 'Pass'
when raw_value = 0.9454545454256 then 'Pass'
when raw_value = 0.0456474635353 then 'Pass'
when raw_value = 0.4536465665635 then 'Pass'
when raw_value = 0.4536465665635 then 'Pass'
when raw_value = 0.4545465752726 then 'Pass'
when ruid = 2 then 'Not in events_log'
when ruid = 4 then 'Not in events_log'
else 'Failed'
end
as 'Test Result'
from event_log;
select * from Testing_table;
以下是查询结果:
ruid raw_value event_id timestamp Test_ID Test Result
1 0.04583743847 1 2014-03-06 13:33:52.187 <null> Pass
1 0.563363656757 1 2014-03-06 13:33:52.187 <null> Pass
1 0.9267482727372 1 2014-03-06 13:33:52.187 <null> Pass
3 0.0222222222222 2 2014-03-06 13:33:52.187 <null> Pass
3 0.0348343874738 2 2014-03-06 13:33:52.187 <null> Pass
3 0.2323239945454 2 2014-03-06 13:33:52.187 <null> Pass
3 0.5656857676747 2 2014-03-06 13:33:52.187 <null> Pass
3 0.9457458745737 2 2014-03-06 13:33:52.187 <null> Pass
3 0.9457458745737 2 2014-03-06 13:33:52.187 2 <null>
3 0.9732746367437 2 2014-03-06 13:33:52.187 <null> Pass
5 0.0456474635353 3 2014-03-06 13:33:52.187 <null> Pass
5 0.2546456745635 3 2014-03-06 13:33:52.187 <null> Pass
5 0.4536465665635 3 2014-03-06 13:33:52.187 <null> Pass
5 0.9454545454256 3 2014-03-06 13:33:52.187 <null> Pass
5 0.9836438454522 3 2014-03-06 13:33:52.187 <null> Pass
如何让Test_ID列每行加一个?
希望这一切都有意义。