ORDER BY [message #260682] |
Mon, 20 August 2007 12:45 |
bella13
Messages: 90 Registered: July 2005
|
Member |
|
|
When I order by a particular column, this is the order the data is displayed in
52-09
52-09.1
52-09.11
52-09.12
52-09.13
52-09.2
52-09.20
52-09.21
52-09.22
52-09.3
52-09.31
52-09.4
Is there any way i can order it as follows
52-09
52-09.1
52-09.2
52-09.3
52-09.4
52-09.11
52-09.12
52-09.13
52-09.20
52-09.21
52-09.22
52-09.31
thanks for your time and help
|
|
|
|
|
Re: ORDER BY [message #260733 is a reply to message #260682] |
Mon, 20 August 2007 16:03 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
Will the first part of the column ever get bigger then 5? for example could you ever have 100-129.3
If you will, try the following.
order by to_number(substr(col,1,instr(col,'.')-1)),
to_number(substr(col,instr(col,'-')+1,instr(col,'.') - instr(col,'-')-1)),
to_number(substr(col,instr(col,'.')+1))
|
|
|