Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 30534

SQL Query order by month

$
0
0

Hello,

I've build a query that show me the total closed alarms past months. Query works fine except order by month.

select count (*) as Totaal, DATENAME(MONTH, ksubscribers.dbo.monitorAlarm.eventDateTime) as Maand
from ksubscribers.dbo.monitorAlarm
where monitorAlarmStateId = 2 and message not like '%geen-monitoring%'
group by DATENAME(MONTH,ksubscribers.dbo.monitorAlarm.eventDateTime)
order by Maand
Query order now by: Dec, Feb, Jan, Mar, Nov, Okt.
What im doing wrong.

Viewing all articles
Browse latest Browse all 30534

Trending Articles