truncating a datetime in sql
Posted on 2014-07-24
I have this query below that pulls the number of files imported by folder by date. The problem is the date is in this format 2014-06-18 02:36:38.000. So i am getting multiple results for the same day because the times are different. I need them grouped by the date not time. How do i truncate "importDate" to yyyy-mm-dd. I think that will group them correctly.
Select a.ImportDate, count(FileID) as Count, b.pipelineId from cnc_files a (nolock)
join CNC_Pipeline b on a.PipelineID=b.Pipelineid
group by a.importDate, b.PipelineID, b.PipeLineID
order by ImportDate asc
Thank you for the help