Tested in Aqua Data Studio 14.0.3-4 Build #: 34540 on Ubuntu 12.04( Mongo DB 2.4.3)
This issue comming from ticket 10269
drop collection orddate
go
insert into orddate(dates,funds) values(isoDate('2012-12-12T19:18:12.977Z'),10)
go
insert into orddate(dates,funds) values(isoDate('2012-12-13T19:18:12.977Z'),11)
go
insert into orddate(dates,funds) values(isoDate('2012-10-14T19:18:12.977Z'),1)
go
insert into orddate(dates,funds) values(isoDate('2012-10-2T19:18:12.977Z'),5)
go
select dates d from orddate where month(dates) between 1 and 12 group by dates having month(dates) between 1 and 12
--The expression 'month(dates)' should appear among the SELECT fields.
go
Witout alias works correct:
select dates from orddate where month(dates) between 1 and 12 group by dates having month(dates) between 1 and 12
go
With using alias also works correct
select dates d from orddate where month(dates) between 1 and 12 group by dates having month(d) between 1 and 12
go