hempjammer
Technical User
I am wanting to generate a report using TSql and am having problems understanding how to join my queries into a single query.
Query #1:
SELECT distinct(Incident."Group Name"),Count(*) "Backlog"
FROM "_SMDBA_".Incident Incident
WHERE
((Incident."Group Name" LIKE 'IT-%') OR (Incident."Group Name" LIKE 'ITI-%')
OR (Incident."Group Name" LIKE 'ITP-%') OR (Incident."Group Name" LIKE 'ITS-%')
OR (Incident."Group Name" IN ('SYSTEM ADMINS', 'IT-SENIOR STAFF','IT-EHO'))) AND
Incident."State:"='O' and
Incident."Close Date" is null
group by Incident."Group Name"
order by 1
Query #2
SELECT Count(*) "Total Backlog"
FROM "_SMDBA_".Incident Incident
WHERE
((Incident."Group Name" LIKE 'IT-%') OR (Incident."Group Name" LIKE 'ITI-%')
OR (Incident."Group Name" LIKE 'ITP-%') OR (Incident."Group Name" LIKE 'ITS-%')
OR (Incident."Group Name" IN ('SYSTEM ADMINS', 'IT-SENIOR STAFF','IT-EHO'))) AND
Incident."State:"='O' and
Incident."Close Date" is null
The results that I would like are:
Group Name Backlog
------------------------------ -----------
IT-APPSUPP GLOBAL 1
IT-EBS 261
Total Backlog
-------------
262
Many thanks in advance
Query #1:
SELECT distinct(Incident."Group Name"),Count(*) "Backlog"
FROM "_SMDBA_".Incident Incident
WHERE
((Incident."Group Name" LIKE 'IT-%') OR (Incident."Group Name" LIKE 'ITI-%')
OR (Incident."Group Name" LIKE 'ITP-%') OR (Incident."Group Name" LIKE 'ITS-%')
OR (Incident."Group Name" IN ('SYSTEM ADMINS', 'IT-SENIOR STAFF','IT-EHO'))) AND
Incident."State:"='O' and
Incident."Close Date" is null
group by Incident."Group Name"
order by 1
Query #2
SELECT Count(*) "Total Backlog"
FROM "_SMDBA_".Incident Incident
WHERE
((Incident."Group Name" LIKE 'IT-%') OR (Incident."Group Name" LIKE 'ITI-%')
OR (Incident."Group Name" LIKE 'ITP-%') OR (Incident."Group Name" LIKE 'ITS-%')
OR (Incident."Group Name" IN ('SYSTEM ADMINS', 'IT-SENIOR STAFF','IT-EHO'))) AND
Incident."State:"='O' and
Incident."Close Date" is null
The results that I would like are:
Group Name Backlog
------------------------------ -----------
IT-APPSUPP GLOBAL 1
IT-EBS 261
Total Backlog
-------------
262
Many thanks in advance