sql condition on temporary column

Solutions on MaxInterview for sql condition on temporary column by the best coders in the world

showing results for - "sql condition on temporary column"
Cristina
20 Jun 2016
1-- NOTE: this is for SQL-Oracle specifically
2
3-- syntax:
4SELECT *
5FROM 
6(
7  SELECT 
8  	 <column_1_value>         <column_1_temp_name>
9  	,<column_2_value>         <column_2_temp_name>
10  	,<column_3_value>         <column_3_temp_name>
11  FROM <_table_name_>
12)
13WHERE <condition_including:<temp_column_name> >;
14
15-- example:
16SELECT * 
17FROM 
18(
19  SELECT
20     (AMOUNT)                  TOTAL -- note: NOT ... as "col_1"
21    ,((AMOUNT) + (TAX))        TOTAL_WITH_TAX
22    ,((AMOUNT) - (DISCOUNT))   TOTAL_WITH_DISC
23  FROM SHOPPER
24)
25WHERE TOTAL_WITH_TAX > 115.00;
26