rob2093124
Technical User
Good Morning!
I'm new to SQL coding and am trying to find a way to run a query and look to need some help
Table: Last Month Incidents
Used Columns:Assignment Group, Business duration
Issue:I have a table populated by incident tickets along with a field for Business Duration that shows how long they've been opened. I am trying to run a query that groups by the Assignment Group and gives counts for Total Completed, Same Day Completions, Within 3 Days Completions, etc. So far, I've come up with:
SELECT [Last Month Incidents].[Assignment Group], Count(*) AS MonthlyCount,
(SELECT COUNT(*) FROM [Last Month Incidents] WHERE [Last Month Incidents].[Business duration] >432000) AS Over5Days
FROM [Last Month Incidents]
GROUP BY [Last Month Incidents].[Assignment Group];
This gives me Total Completed by each group, but then give me the same number for "Over5Days" in all groups that represents the amount of tickets open for all days for ALL groups. I don't know of a way to keep the "Over5Days" counts specific to their Assignment Groups as well. Is this possible?
I'm new to SQL coding and am trying to find a way to run a query and look to need some help
Table: Last Month Incidents
Used Columns:Assignment Group, Business duration
Issue:I have a table populated by incident tickets along with a field for Business Duration that shows how long they've been opened. I am trying to run a query that groups by the Assignment Group and gives counts for Total Completed, Same Day Completions, Within 3 Days Completions, etc. So far, I've come up with:
SELECT [Last Month Incidents].[Assignment Group], Count(*) AS MonthlyCount,
(SELECT COUNT(*) FROM [Last Month Incidents] WHERE [Last Month Incidents].[Business duration] >432000) AS Over5Days
FROM [Last Month Incidents]
GROUP BY [Last Month Incidents].[Assignment Group];
This gives me Total Completed by each group, but then give me the same number for "Over5Days" in all groups that represents the amount of tickets open for all days for ALL groups. I don't know of a way to keep the "Over5Days" counts specific to their Assignment Groups as well. Is this possible?