我在查看以下結構行組的名字,並得到空值
**Month| Doctor| Executive| Revenue**
1 | A | 1 | 100
1 | B | 1 | 200
NULL | C | 1 | 0
NULL | D | 2 | 0
2 | A | 1 | 400
1 | E | 1 | 100
NULL | F | 2 | 0
2 | A | 1 | 300
我想作爲
**Executive| Doctor| Revenue| Month**
1 | A | 100 | 1
1 | B | 200 | 1
1 | C | 0 | 1
1 | E | 100 | 1
我想執行1的所有醫生都在輸出結果即使是月份列也具有NULL值。
,當我試圖與查詢
select DocName,sum(rate),sum(patients) from DoctorRevenue
where SECode=1 and VisitMonth=10
group by DocName
它給A,B,E僅但我想C到進來的輸出。
嘗試isnull(VisitMonth,10)= 10 – 2015-02-23 07:55:52
您的表結構和查詢彼此不適合。 – 2015-02-23 08:04:04