Order By

  • We want to return records, from a select statement, in sequential order (1,2,3,etc..). Currently we are using an order by statement at the end, however it orders them by first digit, then second digit, etc. (1,10,12). How can we set this up correctly?

    select distinct id

    from Location

    order by id asc

  • Is the Location id column a string data type, like varchar or nvarchar?

    If it is, you will have to cast the column to an integer datatype in the order by. Or convert the column to an integer data type.

  • Got it! Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply