Hi,
For following data:
date|value|check
2009 | 5 | 1
2008 | 5 | 1
2007 | 5 | 1
2006 | 5 | 0
2005 | 5 | 0
2004 | 5 | 1
2003 | 5 | 1
2002 | 5 | 1
I need to select all rows from 2009 back until first occurrence of 0 in check column:
date|value|check
2009 | 5 | 1
2008 | 5 | 1
2007 | 5 | 1
I tried with the lag function, but I was only able to check a month back.
I am working on Oracle 10g.
Thank you in advance,
UPDATE:
All seems to work well, my test data set is too small to say anything about the performance differences. Thank you for all your inputs!