Hello,
here a part of the table:
id = 0000000006
actiontype = 1
datafield = 90000,Manuel
i wrote following script, to split datafield values in two fields:
Select `actiontype`,
case when instr(`datafield`, ',') > 0
then substr(`datafield`, 1, instr(`datafield`, ',')-1)
else ' '
end as user_id
,
case when instr(`datafield`, ',') > 0 and instr(`datafield`, ',') < length(`datafield`)
then substr(`datafield`, instr(`datafield`, ',') + 1)
else `datafield`
end as first_name
from `interfacetbl`
WHERE actiontype = 1
Now, i would like to know how to split field values in more then two fields,
for example:
id = 0000000006
actiontype = 1
datafield = 90000,Manuel,Weis,printcarrier.com
The four fields:
user_id = 90000
first_name = Manuel
last_name = Weis
company = printcarrier.com
How to realize?
