how to get rolling last 5 months in netezza
<p>I am simply trying to get the rolling 12 months in netezza and i can't seem to find any good solution so far..</p>

<pre><code>  Contract      SpendDate     Expenses
    sfd6s        2016205       8765
    axy12        2016206       1320
    axy12        2016307       12980
    axy12        2016308       1260
    axy12        2016309       1200
    rhg65        2016410       7800
    fdhju        2016411       300
</code></pre>

<p>here is how my query look like:</p>

<pre><code>select contract, spendDate, expenses 
from myTable
</code></pre>

<p>here is the trick, the spendDate format is like this:</p>

<pre><code>Year + Quarter + Month
</code></pre>

<p>so the middle number after the year is the quarter which is either 1, 2, 3 or 4. So in my query, i want to say give the rolling 12 months from today. Please help.<br>
here is my desired results:</p>

<pre><code> Contract      SpendDate     Expenses
    axy12        2016206       1320
    axy12        2016307       12980
    axy12        2016308       1260
    axy12        2016309       1200
    rhg65        2016410       7800
</code></pre>