Question : i have coloum of id like "abcd-xyz-101-pqrs". i have to split it into 4 parts based on "-". xyz not a constant of 3 characters. some times it may be 4 or 5 charcters. how can i split it.
Select substr("abcd-xyz-101-pqrs",1,instr("abcd-xyz-101-pqrs","-",1,1)-1) AS FirstColumn, substr("abcd-xyz-101-pqrs",instr("abcd-xyz-101-pqrs","-",1,1)+1,instr("abcd-xyz-101-pqrs","-",1,2)-1) AS SecondColumn, substr("abcd-xyz-101-pqrs",instr("abcd-xyz-101-pqrs","-",1,2)+1,instr("abcd-xyz-101-pqrs","-",1,3)-1) AS ThirdColumn, substr("abcd-xyz-101-pqrs",instr("abcd-xyz-101-pqrs","-",1,3)+1,count("abcd-xyz-101-pqrs") AS FourthColumn from sample