How to get the second last partition in hive (HQL)
<p>I have a hive table with below partitions:</p>

<p><code>part_date='07-12-2016'</code></p>

<p><code>part_date='04-12-2016'</code></p>

<p><code>part_date='01-12-2016'</code></p>

<p>Now how can I get the first partition which is less than the most recent partition in hive query. Assuming the partition values are the date when the data is ingested into the table. 
In this case it should be part_date='04-12-2016'.</p>

<p>so the query should be like:</p>

<p><code>select part_date  from table_A where part_date &gt; second_last_partition(ie 04-12-2016);</code></p>

<p>Thanks in advance</p>