Check level with t-sql
Posted on 2011-10-31
I have this table looking like this.
the data in the table can look like this
premiumID premiumName premiumLevel
1 Goldcustomer 10000
2 Silvercustomer 7500
3 Bronscustomer 5000
Now I want to check what level a customers total shopping amount is. So for example if the customers amount is 6543 the query would return premiumID=3 since the amount is larger than 5000 but less then 7500. If the amount is 8500 the premiumID = 2 and so on. How can I achieve this with a t-sql query?
Thanks for help!