> cycleNO| month | year| start date | close date |state | prv month | next mnt
> 1 4 2012 1/4/2012 30/4/2012 23:59:59 1 3 5
> 1 5 2012 1/5/2012 31/5/2012 23:59:59 0 4 6
> 1 6 2012 1/6/2012 30/6/2012 23:59:59 0 5 7
> 1 7 2012 1/7/2012 31/7/2012 23:59:59 0 6 8
> 2 4 2012 1/4/2012 30/4/2012 23:59:59 1 3 5
> 2 5 2012 1/5/2012 31/5/2012 23:59:59 0 4 6
> 2 6 2012 1/6/2012 30/6/2012 23:59:59 0 5 7
> 2 7 2012 1/7/2012 31/7/2012 23:59:59 0 6 8
I have a table (cycle_set) like above and want to fetch (cycleNO,month,year,start date,close date) with the condition where state =0 and start-close date which contains the system date within also the immediate next month with state =0.
Output should be :
cycleNO | month | year | start date | close date 1 5 2012 1/5/2012 31/5/2012 23:59:59 1 6 2012 1/6/2012 30/6/2012 23:59:59 2 5 2012 1/5/2012 31/5/2012 23:59:59 2 6 2012 1/6/2012 30/6/2012 23:59:59
UPDATE: If you want to get both current and next month: