I have a problem about SQL. How can i split a string with a delimiter ‘ ‘ character and access that parts to update a row ? .. To clearify that :
Table is like:
Products ( Name, Colors, Data1, Data2, Data3)
a red green blue
b white black
And i want to do something like :
Products ( Name, Colors, Data1, Data2, Data3)
a red green blue red green blue
b white black white black
Looks like the numbers of columns(Data1, Data2, Data3) is not dynamic.
So I assume that the field ‘Colors’ can have maximum of three words separated by space.
Then the quick and dirty way to do is write a series of update statements like this:
where get_color is going to be a custom function that returns the nth word from a given string: