I have a SQL statment that I am trying to pull the sum for all JobTypes, for example, if there are 5 Jobs with the name "Process" they should show up on only one line with the Sum for the GB and KB. How do I accomplish this? Thanks.
so i would show: – jpavlov 10 mins ago
DEC 1, 2012, Data Extrat, sum(60), sum(56) – jpavlov 8 mins ago
DEC 1, 2012, Process, sum(60), sum(56)
SELECT
Jobs.DateCompleted AS 'DateCompleted',
JobTypes.Name AS 'JobName',
SUM(Metrics.GB) AS GB,
SUM(Metrics.KB) AS KB
FROM Metrics
INNER JOIN
Jobs ON Jobs.JobId = Metrics.JobId
INNER JOIN
Projects ON Projects.ProjectId = Jobs.ProjectId
INNER JOIN
JobTypes ON JobTypes.JobTypeId = Jobs.JobTypeId
WHERE Jobs.DateCompleted
Between '12/01/2012' AND '12/03/2012'
GROUP BY
Jobs.DateCompleted,
JobTypes.Name
2012-12-01 04:28:15.477 Data Extract 0.200 210903.738
2012-12-01 04:40:07.913 Data Extract 0.781 819388.602
2012-12-01 04:48:45.493 Data Extract 5.278 5538731.844
2012-12-01 04:54:55.483 Data Extract 6.927 7265870.682
2012-12-01 14:11:38.357 Export 13.189 13828648.369
2012-12-01 16:57:54.840 Process 2.054 2156185.331