title: How to give 'where' condition in select query while selecting the columns?
body: <p>I want to give condition in a column selection while performing the select statement.</p>
  <p>I want to perform average of TOTAL_TIMEONSITE, RENAME IT, and want to average it for the values existing in the month of Jun'20, Jul'20 and Aug'20 against a visitor.</p>
  <p>Also the range of the whole query must be the month of Aug'20 only. So I want to put the constraint on TOTAL_TIMEONSITE so that it averages the values for the months of Jun'20, Jul'20 and Aug'20 against a visitor.</p>
  <pre><code>select FULLVISITORID AS VISITOR_ID,
  VISITID AS VISIT_ID,
  VISITSTARTTIME_TS,
  USER_ACCOUNT_TYPE,
  (select AVG(TOTAL_TIMEONSITE) AS AVG_TOTAL_TIME_ON_SITE_LAST_3M FROM &quot;ACRO_DEV&quot;.&quot;GA&quot;.&quot;GA_MAIN&quot; WHERE
   (cast((visitstarttime_ts) as DATE) &gt;= to_date('2020-06-01 00:00:00.000') and CAST((visitstarttime_ts) AS DATE) &lt;= to_date('2020-08-31 23:59:00.000'))
   GROUP BY TOTAL_TIMEONSITE),
  CHANNELGROUPING,
  GEONETWORK_CONTINENT
  from &quot;ACRO_DEV&quot;.&quot;GA&quot;.&quot;GA_MAIN&quot;
  where (FULLVISITORID) in (select distinct (FULLVISITORID) from &quot;ACRO_DEV&quot;.&quot;GA&quot;.&quot;GA_MAIN&quot; where user_account_type in ('anonymous', 'registered') 
  and (cast((visitstarttime_ts) as DATE) &gt;= to_date('2020-08-01 00:00:00.000') and CAST((visitstarttime_ts) AS DATE) &lt;= to_date('2020-08-31 23:59:00.000')));
  </code></pre>
  <p>The issue is that it is giving me the 'select subquery for TOTAL_TIMEONSITE' as the resultant column name and the values in that column are all same but I want the values to be unique for visitors.</p>