I have a table with tax rates where NULL entity type rows represent the default tax rates.
Year End | EntityType | RateType | TaxRate
------------------------------------------
2009 | NULL | Interest | 13
2009 | NULL | Other | 8
2009 | NULL | Interest | 13
2010 | NULL | Other | 9
2009 | Company | Interest | 15
2010 | Individual | Other | 6
I want to create a stored procedure for this table with Entitytype as a parameter. Such that for each year, it returns the tax rate for that entity type if it exists, otherwise return the NULL row for that year and ratetype.
i.e.: querying the above with entitytype individual should return
Year End | EntityType | RateType | TaxRate
------------------------------------------
2009 | NULL | Interest | 13
2009 | NULL | Other | 8
2009 | NULL | Interest | 13
2010 | Individual | Other | 6
Can anybody suggest a way I could achieve this?
Thanks in advance,
Yong