January 20, 2014 at 3:17 am
Hi,
I need to get monthly count of number of tickets closed. Is it possible to use COUNT() with DATETYPE field?
SELECT
ID,
Environment
,count((RT.[type])) As 'Type'
,convert(varchar(5),SD.StartDate,110) AS [Month]
FROM TABLENAME
GROUP BY Date, Type
Thanks
January 20, 2014 at 3:28 am
It should be, but why count(<column name>) rather than Count(*)?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 21, 2014 at 7:57 am
sql_ques (1/20/2014)
Hi,I need to get monthly count of number of tickets closed. Is it possible to use COUNT() with DATETYPE field?
SELECT
ID,
Environment
,count((RT.[type])) As 'Type'
,convert(varchar(5),SD.StartDate,110) AS [Month]
FROM TABLENAME
GROUP BY Date, Type
Thanks
You must put ID and Environment in the GROUP BY clause.
Regards,
IgorMi
Igor Micev,My blog: www.igormicev.com
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply