title: Selecting YYYYMM of the previous month in HIVE
body: <p>I am using Hive, so the SQL syntax might be slightly different. How do I get the data from the previous month? For example, if today is 2015-04-30, I need the data from March in this format 201503? Thanks!</p>
  
  <pre><code>select 
      employee_id, hours,
      previous_month_date--YYYYMM,
  from 
      employees 
  where 
      previous_month_date = cast(FROM_UNIXTIME(UNIX_TIMESTAMP(),'yyyy-MM-dd') as int)
  </code></pre>