Posted On: Aug 7, 2018
Amazon Redshift now enables you to write queries that refer to a column alias within the same query immediately after it is declared, improving the readability of complex SQL queries.
The support for lateral column alias reference enables you to write queries without repeating the same expressions in the SELECT list. For example, you can define the alias 'probability' and use it within the same select statement:
select clicks / impressions as probability, round(100 * probability, 1) as percentage from raw_data;