Details
- 
    New Feature 
- 
    Status: Closed (View Workflow)
- 
    Major 
- 
    Resolution: Won't Do
- 
    1.0.11
- 
    None
Description
it is technically valid to have the following query:
| MariaDB [test]> select y, substr(c,1,2), count(*) from o1 group by y,c; | 
| ERROR 1815 (HY000): Internal error: IDB-2021: 'substr(c,1,2)' is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.
 | 
the intent of this would be to group by y,c then apply the substr expression on the resulting group by columns.
A workaround is to move the group by to a subquery and apply the substr in the outer sql:
| select y, substr(c, 1,2) c, cnt from (select y, c, count(*) cnt from o1 group by y,c) t;
 |