M
mscertified
I have the following SQL:
SELECT TCreator AS Agent, Datepart('yyyy',Opendate) & '-' &
DatePart('m',opendate) AS [Month], "Other" AS Assigned, Count(ContactVia) AS
CV, count(*) AS Numb
FROM tblCSTickets
WHERE CloseDate IS NOT NULL and LastAssignedTo IS NOT NULL and
LastAssignedTo <> "Customer Support"
GROUP BY TCreator, Datepart('yyyy',Opendate) & '-' & DatePart('m',opendate);
However, I need the count for 'ContactVia' to only count those rows where
the value is '1'. I still need all rows grouped. Can this be done in a single
query?
SELECT TCreator AS Agent, Datepart('yyyy',Opendate) & '-' &
DatePart('m',opendate) AS [Month], "Other" AS Assigned, Count(ContactVia) AS
CV, count(*) AS Numb
FROM tblCSTickets
WHERE CloseDate IS NOT NULL and LastAssignedTo IS NOT NULL and
LastAssignedTo <> "Customer Support"
GROUP BY TCreator, Datepart('yyyy',Opendate) & '-' & DatePart('m',opendate);
However, I need the count for 'ContactVia' to only count those rows where
the value is '1'. I still need all rows grouped. Can this be done in a single
query?