Dear community,
I have no idea to compare between current year data and last year data.
Look at the chart, there are 4 years.
If last year not exists same PATNO, NEW_PATNO will be 1.
2008 : In 2008, There are PATNO(1,2,3,4,5,6). PATNO(1,2,3,4,5,6) not exist last year becuz 2008 is starting point.
PATNO(1,2,3,4,5,6) will be one.
2009 : In 2009, There are PATNO(1,2,3,7,8,9). PATNO(1,2,3) exist in 2008. PATNO(1,2,3) will be 0
and PATNO(7,8,9) will be 1.
2010 and 2100 same method
How can I make this chart?
YEAR | PATNO | NEW_PATNO |
2008 | 1 | 1 |
2008 | 2 | 1 |
2008 | 3 | 1 |
2008 | 4 | 1 |
2008 | 5 | 1 |
2008 | 6 | 1 |
2009 | 1 | 0 |
2009 | 2 | 0 |
2009 | 3 | 0 |
2009 | 7 | 1 |
2009 | 8 | 1 |
2009 | 9 | 1 |
2010 | 7 | 0 |
2010 | 8 | 0 |
2010 | 10 | 1 |
2010 | 11 | 1 |
2010 | 12 | 1 |
2010 | 13 | 1 |
2011 | 12 | 0 |
2011 | 13 | 0 |
2011 | 1 | 0 |
2011 | 7 | 0 |
2011 | 16 | 1 |
2011 | 17 | 1 |