Search This Blog

Wednesday, 30 January 2013

To display number of sales for each day from begin date or Sql query to Group by day in sql server

SELECT DATEADD(DAY, DATEDIFF(DAY, 0, SMD.CreatedDate), 0) AS CreatedOn
    ,COUNT(SMD.CreatedDate) as [Count]       
    FROM TableName SMD
    GROUP BY DATEADD(DAY, DATEDIFF(DAY, 0, SMD.CreatedDate), 0)

No comments:

Post a Comment