0

I need some help with a SQL Server query. The table has some kind of field like the following ones:

100
101
102
101/100
101/101

I'd want to sort them to look like this:

100
101
101/100
101/101
102

How can I solve this? Thanks in advance, regards.

1 Answer 1

2

You don't give any details on data types and the characteristics of the data. However, based on what you did say, this should work. This will order the data on the first three characters of the column.

Select *
From MyTable
Order By Left(MyColumn,3)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much, i can't believe it was so easy to do. May someone mark this answer as valid?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.