Cannot Display months in Order
hi, in the report i'm seeing month names alphabatically like ... April,August,December but Not Jan,Feb,Mar... I'm using the below query... but could not get the result . can any 1 plz help me with the query or.. is there any report property i can use to display months in order.. thanks. SELECT userid,case when DATEPART(MONTH,logtime) = 1 then 'January' when DATEPART(MONTH,logtime) = 2 then 'February' when DATEPART(MONTH,logtime) = 3 then 'March' when DATEPART(MONTH,logtime) = 4 then 'April' when DATEPART(MONTH,logtime) = 5 then 'May' when DATEPART(MONTH,logtime) = 6 then 'June' when DATEPART(MONTH,logtime) = 7 then 'July' when DATEPART(MONTH,logtime) = 8 then 'August' when DATEPART(MONTH,logtime) = 9 then 'September' when DATEPART(MONTH,logtime) = 10 then 'October' when DATEPART(MONTH,logtime) = 11 then 'November' when DATEPART(MONTH,logtime) = 12 then 'December' end AS Monthlog,COUNT(userid) AS LogCount FROM [IBS].[dbo].[ActivityLog] WHERE PortalName = 'Quik' AND PROPERTY IS NULL AND MESSAGE LIKE '%logged in successfully.' group by userid,DATEPART(MONTH,logtime ) order by userid,DATEPART(MONTH,logtime )
April 20th, 2011 10:56am

The query itself should be sorting the rows correctly (assuming that you want the report sorted by userid first then by month). My guess is that you have overridden that sort with an additional sort in the report itself. It would probable help to add DatePart(mm, logtime) AS MonthNumber, to your select list. You don't have to display it on the report design but it would be available to sort on within the report. JasonJason Long
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2011 11:11am

thanks jason... it helped...
April 20th, 2011 11:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics