Jumat, 03 April 2015

Sub Total in Each Row

SELECT [e]+[f] AS masuk, [h]+[i] AS keluar, *
FROM kegiatan_2kas
WHERE a Like '2.2.1.*.*' And key=2012
ORDER BY b;

Order By Split Column


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

Foto Propades