I have an issue when using a WHERE statement in HSQL. When I enter the code as follows I get no errors:
"SELECT Year, ProjectName, (cast(sum(Missed) as float)/(select cast(sum(d.Missed) as float) from Draft d)) as MissedPer from Draft group by ProjectName, Year order by ProjectName"
However, when I add a WHERE statement inside the nested query I get an error:
"SELECT Year, ProjectName, (cast(sum(Missed) as float)/(select cast(sum(d.Missed) as float) from Draft d where Year = '19.12')) as MissedPer from Draft group by ProjectName, Year order by ProjectName"
The error is the following:
Exception in thread "main" java.sql.SQLSyntaxErrorException: expression not in aggregate or GROUP BY columns: CAST(( SUM(PUBLIC.DRAFT.MISSED)) AS DOUBLE)/(()) in statement [SELECT BranchNo, ProjectName, (cast(sum(Missed) as float)/(select cast(sum(d.Missed) as float) from Draft d where d.BranchNo = '19.12')) as MissedPer from Draft group by ProjectName, BranchNo order by ProjectName]
I don't know how to make this work, please help.
question from:
https://stackoverflow.com/questions/65883347/issues-when-using-hsql-and-where-statement 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…