Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Grouping records in a particular way

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-31 : 18:51:54
Saiju writes "I want to group the record co_id in the following way
co_id
101
102
103
1
201
202
203
2
301
302
303
3

But i am getting it this order
co_id
1
101
102
103
2
201
202
203
3
301
302
303"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-10-31 : 19:46:49
order by case when len(co_id) = 1 then '0' else '1' end + convert(varchar(10), co_id)

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-10-31 : 20:34:42
or

ORDER BY co_id + '9999999'

Go to Top of Page
   

- Advertisement -