Today i want to show how to split a String with a delimiter in SQL for example in a table with modelnumbers which consists of two parts sperated by a slash.
model
A1/44
CX3/2
C/140
To get the first and second part of the modelnumber you can use
select LEFT( trim(model),LENGTH(trim(model))-ABS(LOCATE('/',trim(model))-1)) model1, RIGHT( trim(model), LENGTH(trim(model))-LOCATE('/',trim(model))) model2 from modeltable
to get the result:
model1 model2
A1 44
CX3 2
C 140
ad
No comments:
Post a Comment