I have a query which gives me the count by company/contractor, but now i need to modify it to include rows that have a value "1" in another column.
Query:
Select
Date,
process,
Process Type,
SUM(ISNULL(CAST(COMPANYCOUNT AS INT),0)) AS COMPANY
SUM(ISNULL(CAST(CONTRACTORCOUNT AS INT),0)) AS CONTRACTOR
Output:
Date Process Process Type Company Contractor
7/3/18 Service 1 1 3
7/3/18 Service 0 1 1
I want my output to give me the count by company/contractor when "Process Type" = "1". It should ignore all rows that have '0'.
Can someone help me how can i modify my SUM() statement to get this?