October 29, 2005 at 5:53 am
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"
October 29, 2005 at 8:48 pm
looks like your co_id is char / varchar.
as the ascii code for space (' ') (Ascii 32) is smaller than zero ('0') (Ascii 48), it will be ordered that way
if you can alter the table structure, try adding another integer column and set the value of the column to your desired ordering sequence
October 30, 2005 at 9:31 pm
Since it seems to be char or varchar, if field only stores numeric values, the following might give the results you want:
select * from testid order by rtrim(co_id) + 'ZZZZZ'
If it can contain alpha, this would have to be adjusted.
October 31, 2005 at 12:14 am
Thank You Very much ......
It is working
Saiju Thomas
October 31, 2005 at 4:57 am
Good Idea !
October 31, 2005 at 5:49 am
You're welcome.
I'm glad it worked for you.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply