Help with T-Sql query novice

  • 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

     

    CodeAMOUNT
    290610
    290715
    290820
    290125
    290440
    290550
    291175
    2909100
  • 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

  • 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