but this is hardly a useful result? Another possibility is to randomly pick one row from each group, like:
2014 30 -- 10+20 in group 1
2015 40 -- 15+25 in group 2
The results are unpredictable and you may get different result for the same data/query.
SQL92 requires that all columns in the SELECT CLAUSE
is part of the GROUP BY CLAUSE
, so if we want:
Since there is only one PARAMETERNO per YEAR, the result is the same.
MySQL historically allowed you to violate the SQL92 as well as the SQL99 GROUP BY
rule, unless you specified ONLY_FULL_GROUP_BY in @@sql_mode. This may lead to un-deterministic results, and has caused much confusion in forums such as this one over the years. I personally always set @@sql_mode to ONLY_FULL_GROUP_BY when using older MySQL version than the latest (which I havent tried).