Hi,
I have a table with over 100K rows. See sample data attached:
SBSB_ID From Date Units
780000110 9/14/2011 8
780000110 10/3/2011 8
780000110 10/4/2011 6
780000110 10/5/2011 4
780000110 10/10/2011 3
780000110 12/8/2011 2
780000110 12/9/2011 4
780000110 12/13/2011 8
780000110 6/21/2012 4
780000114 6/19/2012 2
780000114 6/20/2012 2
What I need to do evaluate each record to identify the SBSB_ID record which contains a sum(units) >=80 within a 14 day period from the first From Date. I also need to identify the SBSB_ID record which contains a sum(units) >=100 within a 30 day period from the first From Date.
Once a SBSB_ID meets this criteria, I need to start over again by the next From Date after the criteria is met.
Is this possible? Thanks in advance for any help.
I have a table with over 100K rows. See sample data attached:
SBSB_ID From Date Units
780000110 9/14/2011 8
780000110 10/3/2011 8
780000110 10/4/2011 6
780000110 10/5/2011 4
780000110 10/10/2011 3
780000110 12/8/2011 2
780000110 12/9/2011 4
780000110 12/13/2011 8
780000110 6/21/2012 4
780000114 6/19/2012 2
780000114 6/20/2012 2
What I need to do evaluate each record to identify the SBSB_ID record which contains a sum(units) >=80 within a 14 day period from the first From Date. I also need to identify the SBSB_ID record which contains a sum(units) >=100 within a 30 day period from the first From Date.
Once a SBSB_ID meets this criteria, I need to start over again by the next From Date after the criteria is met.
Is this possible? Thanks in advance for any help.