title: Hive + Pass previous day date to like clause
body: <p>Am trying to fetch records from hive table based on the previous date.
  Example: If table is as follows</p>
  
  <p><strong>CustomerVisit</strong> table </p>
  
  <pre><code>ID NAME VISIT_DATE
  ------------------
  
  01 Harish 2018-02-31
  
  03 Satish 2017-02-13
  
  04 Shiva  2018-03-04
  </code></pre>
  
  <p>Now i need to fetch all records that have <code>visit_date = 2018-03-04</code> (i.e today's date -1). </p>
  
  <blockquote>
    <p>Expected Query something like: </p>
  </blockquote>
  
  <pre><code>select ID, Name from CustomerVisit where 
  visit_date like concat((select date_sub(current_date, 1)),'%')
  </code></pre>
  
  <p>I have tried following </p>
  
  <pre><code>select current_date; - Gives current date
  
  select date_sub(current_date, 1) - Gives previous date
  
  select concat(tab1.date1,'%') from 
  (select date_sub(current_date, 1) as date1) as tab1; -- Gives the previous date appended with % which i need to use in like
  </code></pre>
  
  <p>but when i use the above as sub-query like below it fails with </p>
  
  <pre><code>select tab2.id, (select concat(tab1.date1,'%') as pattern from 
  (select date_sub(current_date, 1) as date1) as tab1) from CustomerVisit as tab2 limit 1;
  </code></pre>
  
  <blockquote>
    <p>FAILED: ParseException line 1:0 cannot recognize input near 'seelct' 'current_date' ''</p>
  </blockquote>
  
  <p>How to write query to get results for previous date?</p>