title: Redshift UNLOAD concatenate file name
body: <p>I have a UNLOAD query in Redshift where I need the file name to be generated dynamically like 'Filename.year.quarter' and I am passing a query to derive year and quarter like below: </p>
  
  <pre><code>UNLOAD('Query1') 
  TO  '::P1::/test/test_folder'
       || (select ent_qtr 
           from db.w_day_d 
           where calendar_date=to_char(sysdate, 'yyyy-mm-dd 00:00:00')) 
       || (select ent_year 
           from db.w_day_d 
           where calendar_date=to_char(sysdate, 'yyyy-mm-dd 00:00:00')) 
  CREDENTIALS 'aws_access_key_id=::P2::;aws_secret_access_key=::P3::' ADDQUOTES
  DELIMITER as ',' ALLOWOVERWRITE NULL as ''  HEADER PARALLEL OFF;
  </code></pre>
  
  <p>But this query is not allowing me to use || operator too. Can anyone please suggest a better way in deriving a filename like 'Filename.year.quarter' ? </p>
  
  <p>Thanks</p>