Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
set nocount on
declare @tbl table(itemNo int, qty int, discount real)
insert into @tbl(itemNo, qty, discount)
select 100, 10, .15
union all
select 100, 20, .18
union all
select 100, 30, .19
union all
select 101, 10, .11
union all
select 101, 20, .13
union all
select 101, 30, .17
select isNull(MAX(discount),0)
from
(
select discount
from @tbl
where qty < 25 and itemNo = '101'
) as s
select top 1 * from @MyTable
where Qty <= 25
order by Qty desc