× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
slavakiev reported 2013-10-03T13:04:09Z  · tariqrahiman last modified 2015-07-07T20:08:06Z

Same aggreagate command works differ with and without GROUP BY in SQL


Priority Low
Complexity Unknown
Component MongoSQL
Version 17.0

Tested in Aqua Data Studio 14.0.0-rc-39 Build #: 34238 on Ubuntu 12.04( Mongo DB 2.4.3)

Same aggregate commands ( just _id:0 and _id:1 in the $group) used for some SQL statements deespite on using GROUP BY in SQL. But results differ:   
1.
--Without GROUP BY
select month(date()) as mnn,AVG(valuation) as a,min(city) as c from baseball 
where mnn=9 and city in ['Chicago','NewYork'] and stats[0].year in [1904] and teamName='Cubs-2' and ((managerName.first='John') or (colors[0]='blue'))   
--Invalid query: cannot have both aggregate and conversion functions.
go
--With GROUP BY

select month(date()) as mnn,AVG(valuation) as a,min(city) as c from baseball where mnn=9 and  city in ['Chicago','NewYork'] and stats[0].year in [1904] and teamName='Cubs-2' and ((managerName.first='John') or (colors[0]='blue')) group by valuation  

--works correct
go
 
2.
--Without GROUP BY
select month(dates) from orddate where month(dates) <=12 and funds>1   
select dates+1 from orddate where month(dates)=12 and year(dates)=2012       
--The expression 'month(dates)' should appear among the SELECT fields
go
--With GROUP BY

select month(dates) from orddate where month(dates) <=12 and funds>1  group by dates 

select dates+1 from orddate where month(dates)=12 and year(dates)=2012  group by dates      

--works correct
go
 
Necessary to use same program code for such case.
 
1 attachment

Issue #10303

Closed
Won't Fix
Resolved 2015-04-24T19:05:21Z
 
 
Completion
No due date
No fixed build
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017