Hi everyone, I have a problem in MS SQL.
Due to academic nature, I am supposed to use a query to find out the present applicable tax rate (GST, Good & Sales Tax) without altering the table.
The table has 3 tax rates,
1: WEF (With Effect From) 2004 Jan 1 --- 5%
2: WEF 2007 Jul 1 --- 7%
3: WEF 2011 Jan 1 --- 8%
As of writing in 2010, I would need to use a query to return tax rate as 7% (1 year later, this code should return 8% instead)
This was what I found:
Select Min(datediff(day,EffectiveDate,getdate())) From GST where datediff(day,EffectiveDate,getdate())> 0;
This code can only detect the minimum past dates (I.e, pointing at 2007 one instead of the 2004 which was a past or 2011 which is future as of writing.)
How can I use the above code to return 7% instead (For now)?
Thank u in advance.
Edited by samuel_1991: n/a