Query to get Count
Posted: Mon Jul 02, 2012 7:20 am
Hi,
I have table
DESC SUCC_COUNT FAIL_COUNT
==================================
ABC 5 1
BCD 7 2
Here my intension is to find the sum of SUCC_COUNT and FAIL_COUNT for list of DESC. I have a possible list of values for DESC . DESC values should be among (ABC,BCD,CDE,XYZ). Here there are cases where some of the DESC would be present in table.
The query which I have
SELECT DESC, SUM(SUCC_COUNT,FAIL_COUNT) FROM TABLEA WHERE DESC in ('ABC','BCD','CDE',XYZ');
But this would return
ABC 6
BCD 9.
Am looking for a query which should return me
ABC 6
BCD 9
CDE 0
XYZ 0.
What way should I modify the script?.
Thanks
Sach
I have table
DESC SUCC_COUNT FAIL_COUNT
==================================
ABC 5 1
BCD 7 2
Here my intension is to find the sum of SUCC_COUNT and FAIL_COUNT for list of DESC. I have a possible list of values for DESC . DESC values should be among (ABC,BCD,CDE,XYZ). Here there are cases where some of the DESC would be present in table.
The query which I have
SELECT DESC, SUM(SUCC_COUNT,FAIL_COUNT) FROM TABLEA WHERE DESC in ('ABC','BCD','CDE',XYZ');
But this would return
ABC 6
BCD 9.
Am looking for a query which should return me
ABC 6
BCD 9
CDE 0
XYZ 0.
What way should I modify the script?.
Thanks
Sach