July 9, 2004 at 5:21 pm
Hello,
I'm new to SQL2K but excited to be in a position to learn SQL. I was hoping I could get some help in writing a query that would compare a value to a table and return next hight amount if not equal to that value.
if amount = 10 then return 10
if amount > 10 and <= 15 then return 15 and so on
How do I return a single value? Thanks for your help
select Code,min(Amount)
from dbo.tbl_Codes
where Amount >= @Amt
group by Code,Amount
Code | AMOUNT |
2906 | 10 |
2907 | 15 |
2908 | 20 |
2901 | 25 |
2904 | 40 |
2905 | 50 |
2911 | 75 |
2909 | 100 |
July 9, 2004 at 5:36 pm
I believe I might have found a way. I just added TOP 1 to my query. Will this work or is there a better way. Thanks
July 9, 2004 at 11:40 pm
you should elobarate about what u want
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply