0
我有一個統計值的特定類型的數據的查詢:請在SQL查詢的條目
SELECT
B.BG_USER_05 as Functionality,
count(case when bg_status= 'New' then 1 end) as 'New',
count(case when bg_status= 'Open' then 1 end) as 'Open',
count(case when bg_status= 'Assigned' then 1 end) as 'Assigned',
count(case when bg_status= 'Fixed' then 1 end) as 'Fixed',
count(case when bg_status= 'Ready to Test' then 1 end) as 'Ready_to_Test',
count(case when bg_status= 'Reopen' then 1 end) as 'Reopen',
count(case when bg_status= 'Closed' then 1 end) as 'Closed',
count(case when bg_status= 'Rejected' then 1 end) as 'Rejected'
FROM
BUG B,
RELEASES R
WHERE
B.BG_DETECTED_IN_REL = R.REL_ID
GROUP BY
B.BG_USER_05
查詢工作正常,返回是這樣的:
UAT 5 13 2 3 0
SIT 14 82 59 18 8
問題是,有時,表中沒有UAT元素(這是完全正常的),這會使結果如下所示:
SIT 14 82 59 18 8
的問題是,我需要的拳頭行是UAT信息,我需要的結果是事端這樣的:
UAT 0 0 0 0 0
SIT 14 82 59 18 8
我不知道如何處理這個。 有什麼想法?
不得不從查詢中刪除雙引號(因爲查詢是在Excel單元格內編寫的,並且在雙引號內部......可怕的東西,我知道),所以它像一個魅力一樣工作。謝謝! – Leo