Order By Split Column
•
Ditulis oleh Tim Pasti Oke
I have a column call it id:
4.1.2.10.0
4.1.2.3.0
4.1.2.4.0
6.1.20.0.0
6.1.3.0.0
...
etc...What I'd like to do is include an ORDER BY statement that splits the string, to become like this:
4.1.2.3.0
4.1.2.4.0
4.1.2.10.0
6.1.3.0.0
6.1.20.0.0
...
etc....you should do
select *
from tbl
order by CInt(mid(field1,1,instr(1,field1,'.')-1)),
CInt(mid(field1,instr(1,field1,'.')+1,instr(2,field1,'.')-1)),
CInt(mid(field1,instr(3,field1,'.')+1,instr(4,field1,'.')-1)),
CInt(mid(field1,instr(5,field1,'.')+1,instr(6,field1,'.')-1))src https://stackoverflow.com/questions/28934055/order-by-split-column
Butuh solusi instan siap pakai?
Dapatkan modul & script server production-ready langsung di web store kami.
Komentar
Belum ada komentar. Jadilah yang pertama memberikan komentar!