posted 3/6/2009 by Sumit Arora
I wanted the date format from SQL in this way January, 2008. After doing searching I finally found the way to do it. Here is the solution:SELECT DATENAME(month, DateCreated) AS ByMonth, DATENAME(yyyy, DateCreated) AS ByYear, COUNT(*) AS TotalCount FROM Test where userId=@UserID GROUP BY DATENAME(mm, DateCreated), DATENAME(yyyy, DateCreated) ORDER BY ByYear DESCThe output will be in this way nowByMonth ByYear TotalCountMarch 2009 6January 2007 4
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18