I have what I hope has a semi-simple answer.
Running SQL Server 2008 R2.
Let's say that I'm using a database, and need to find out a person's classification, based on how much money they've contributed. Is there a way to do this without hard-coding? The classifications are subject to change, so it would be nice if I could just grab the classification from a table.
What I really want to do, is total all of a contributor's contributions to date, and then return whether their classification, based on the following table:
So I want to run a query that basically can grab the following info (based on the sum of their contributions, which I know how to get, and their place in the above table, which I don't know how to do):
Is there any way to do this with a table lookup, or do I have to resort to hardcoding a CASE...WHEN statement?
Many thanks!
Katie
Running SQL Server 2008 R2.
Let's say that I'm using a database, and need to find out a person's classification, based on how much money they've contributed. Is there a way to do this without hard-coding? The classifications are subject to change, so it would be nice if I could just grab the classification from a table.
What I really want to do, is total all of a contributor's contributions to date, and then return whether their classification, based on the following table:
Code:
Classification,Min,Max
'Non Member',0,49.99
'Professional',50,99.99
'Associate',100,249.99
'Principal',250,499.99
'President',500,999.99
'Chairman',1000,10000000
So I want to run a query that basically can grab the following info (based on the sum of their contributions, which I know how to get, and their place in the above table, which I don't know how to do):
Code:
ContributorID,SumOfAmount,Classification
15,$29.00,'Non Member'
28,$467.00,'Principal'
Is there any way to do this with a table lookup, or do I have to resort to hardcoding a CASE...WHEN statement?
Many thanks!
Katie