hai every one , i have problem with order by decimal number I have revision number column it contains revision number like
1,
2,
2.1,
2.2,
2.3
......
2.10
2.11
...

and am trying to order by revision it's giving sort order like
1,
2,
2.1
2.10
2.11
...
2.2
2.3
...
but i want sort order like..
1,
2,
2.1,
2.2,
2.3
..
2.10
2.11

query is like

SELECT project_name, revision_no from table_name
ORDER BY project_name, revision_no

thank you

Recommended Answers

Try casting you revision_no to a decimal:

order by cast(revision_no as decimal)
Jump to Post

All 3 Replies

Try casting you revision_no to a decimal:

order by cast(revision_no as decimal)

thank you, but it's not working still it's displaying same order

I've tried it here and it works. Show your table structure, and the query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.