WTH* SG EffectiveDate* fr 3 01/01/2010 ox 1 01/01/2010 fr 5 05/01/2012 ox 2 05/01/2012
EQ WTH FTR EffectiveDate A fr 30 01/01/2010 A ox 10 01/01/2010 B fr 50 05/01/2010 B ox 40 05/01/2010 A fr 60 31/12/2011 A ox 15 31/12/2011 B fr 35 05/02/2013 B ox 5 05/02/2013
EQ WTH FTR SG TOTAL A fr 30 3 90 A ox 10 1 10 B fr 50 3 150 B ox 40 1 40 A fr 60 3 180 A ox 15 1 15 B fr 35 5 175 B ox 5 2 10
Select Q2.EQ, Q1.WTH, Q2.FTR Q1.SG, [Q1.SG]*[Q2.FTR] AS Total FROM Table A Q1 INNER JOIN Table B Q2 ON Q1.WTH = Q2.WTH AND Q1.EffectiveDate >= Q2.EffectiveDate
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)