• In the data you have provided the OrderId looks as though it may contain a 2 digit year.

    If this is the case then something like the following may work:

    ORDER BY

    &nbsp&nbsp&nbsp&nbspCASE

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWHEN SUBSTRING(OrderID, 3, 2) < '10'

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspTHEN '20' + RIGHT(OrderID, 7)

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspELSE '19' + RIGHT(OrderID, 7)

    &nbsp&nbsp&nbsp&nbspEND