My DateCompleted return the date and the time. If I would like to group just by the date and ignore the time. How would I go about this?
SELECT
Cast(Jobs.DateCompleted AS VarChar) AS 'DateCompleted',
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
If you are using SQL Server, then you can convert the value as a
varcharwith a format that strips the time:If you are using SQL Server 2008+, then you can cast the value as a date:
Note: I am assuming SQL Server based on your previous tags