Below in the photo I have an allowance column that changes every year based on rates that also change every year. The next year's allowance is based on the previous years * that year rate. The year also runs from April to March
Ideally I want a (preferably) neat SQL code to do this for me and be inputted in an allowance column as shown. I started with declarations and IF statements but was wondering if a simpler solution
IF (Date >= @Year1 AND Date < @Year2) BEGIN SET @Year1Allowance = 30000 END ELSE IF (Date>= @Year2 AND Date < @Year3) BEGIN SET @Year1Allowance*=@Rate2 END ...
Thanks!
Aucun commentaire:
Enregistrer un commentaire