I have a table named paystructure with fields as minSale, maxSale, empCategory, incentiveAmt, qtySold
When i enter quantity sold then i should get the incentiveAmt based on the minSale and maxSale and empCategory.
This can be interpreted as :--
minSale maxSale incentiveAmt
100 200 50
201 300 100
301 400 150
How can i get this value based on qtySold.
I need this urgent help
Please guide me for this query
Thanks in advance.

Jignesh TrivediPosted Dec 12, 2013, 6:20 AM
hi,
you can use Case when in this case...
example..
declare @itemsold int =201
select
case when @itemsold between 100 and 200 then 50
when @itemsold between 201 and 300 then 100
when @itemsold between 301 and 400 then 150 end
hope this will help you.