I have created a query which displays different data when being executed in Microsoft SQL Server Management Studio express than it does when outputting in a browser either using cfdump
or cfoutput
.
Here is the query:
select count(stat_id) as val, month(status_date) as mnth, year(status_date) as yr
from task_status ts
join appraisal.dbo.employee e on e.userID = ts.user_ID
where e.comp = 1
and e.dept = 2
and e.archive != 1
and ts.status_date between '2016-10-01 00:00:00' AND '2017-10-01 00:00:00'
group by month(status_date), year(status_date)
order by year(status_date), month(status_date)
The expected results, and results seen in Management Studio are:
YR MNTH YR
1 10 2016
1 11 2016
9 2 2017
4 3 2017
3 4 2017
18 5 2017
6 6 2017
1 7 2017
However, results seen from the browser are:
YR MNTH VAL
2016 1 7
2016 2 13
2016 3 5
2016 4 5
2016 5 1
2016 6 4
2016 7 2
2016 10 1
2016 11 1
Any suggestions as to what may be causing this would be most welcome, as I have no idea why there is a difference.