Integrate Software AG Products Using Digital Event Services 10.4 | Integrate Software AG Products Using Digital Event Services | MashZone NextGen Help | Appendix | Legacy Presto components | MashZone NextGen Analytics | RAQL Queries | Alias Names for Columns or Calculations | Use Alias Names in Other Clauses
 
Use Alias Names in Other Clauses
The alias name for a column is defined in the Select clause. You cannot use this alias to refer to that column in any RAQL clauses, including expressions for later columns within Select, with the exception of the Order By clause. These RAQL queries, for example, will result in an error:
select Id, Descr, decimal(Qty) as Quantity from items where Quantity > 5
select Id, Descr, decimal(Qty) as Quantity, (Quantity / 1000) as PerMille from items
However, this query is valid:
select Id, Descr, decimal(Qty) as Quantity from items order by Id, Quantity
There are two techniques you can use rather than using an alias. You can duplicate the original column, such as this example:
select Id, Descr, decimal(Qty) as Quantity from items where decimal(Qty) > 5
This can be cumbersome or in some cases impossible where the syntax is complex. Another solution is to define the alias in a subquery so that you can refer to it in an outer query. For an example of this syntax, see From Subqueries.

Copyright © 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release