我寫了下面的查詢:合併具有相同值的行成單排
select distinct
t0.DocDate
,t4.U_SES_VS as 'Value stream'
,case when (t1.ItemCode) = 'WC-QA' then count(t1.itemcode) else 0 end as 'WC-QA'
,case when (t1.ItemCode) = 'WC-REC_INSPECTION' then count(t1.itemcode) else 0 end as 'Inspection'
from ige1 t1
INNER JOIN OIGE T0 ON T1.DOCENTRY = T0.DOCENTRY
and few other tables T2,T3,T4,T5 all on Inner Join
Where t1.qty > = t3.qty
group by t0.docdate,t4.u_ses_vs,t1.itemcode
我有以下的輸出:
**DocDate** | **Value Stream** | **WC-QA** | **Inspection** |
2017-04-14 | Engineering | 0 | 0 |
2017-04-14 | Production | 14 | 0 |
2017-04-14 | Quality | 5 | 0 |
2017-04-14 | Quality | 0 | 1 |
我要合併的質量行是在以下格式:
2017-04-14 | Quality | 5 | 1 |
我該怎麼做?
我與Microsoft SQL Server Management Studio中 –