Use column alias in group by clause

Go to Dutch version

As of release 24.1.115-BETA, Invantive UniversalSQL also supports the use of column aliases in the group by clause. This makes queries clearer and reduces the need for nested selections (inline views).

Under release 24.0 and earlier, the following query resulted in an error message:

select xml || ‘-postfix’ exprcol
, ‘value’ xml
from (select ‘row 1’ xml union all select ‘row 2’ xml)
group
by exprcol

namely:

itgensql037
At least one field did not appear in the group by nor was it aggregated: …

As of release 25.1.115-BETA, this query is executed correctly and returns:

EXPRCOL XML
row 1-postfix value
row 2-postfix value

Using inline views such as select ... from ( select ... from ... ) is therefore significantly less often needed. This increases readability and simplifies developing and maintaining SQL code.