I have table like below in SQL Server.
| Process_ID | Process_Type |
|---|---|
| 011 | P1 |
| 012 | P1 |
| 013 | P2 |
| 014 | P2 |
| 015 | P3 |
| 016 | P3 |
I want to get the count of Process ID for the process type P2 and P3 together. I have used query like below:
select count(Process_ID) as Process_Count, Process_Type
from Process_Table
where Process_type in ('P2','P3')
group by Process_Type;
The result shows:
| Process_Count | Process_Type |
|---|---|
| 2 | P2 |
| 2 | P3 |
But I need like:
| Process_Count | Process_Type |
|---|---|
| 4 | P2_and_P3 |
Can someone help me how I can sum the result which was used under SQL in condition and group by clause and display it in the output?
Thank you in advance.