GROUP BY clause
Some databases allow you to specify a column index in the GROUP
BY clause:
SELECT a, b, sum(c) FROM table GROUP BY 1,2
This is not possible with all database servers:
Database Server Type | GROUP BY colindex, ... ? |
---|---|
IBM® DB2® LUW | No |
IBM Informix® | Yes |
IBM Netezza | No |
Microsoft™ SQL Server | No |
Oracle® MySQL / MariadDB | Yes |
Oracle Database Server | No |
PostgreSQL | Yes |
SAP HANA® | No |
SQLite | Yes |
Search for GROUP BY in your SQL statements and use explicit column names.