I have a string containing multiple products orders which have been joined together without a delimiter.
I need to parse the input string and convert sets of three substrings into separate rows of data.
I tried splitting the string using split()
and strstr()
function, but could not generate the desired result.
How can I convert this statement into different columns?
RM is Malaysian Ringgit
From this statement:
"2 x Brew Coffeee Panas: RM7.42 x Tongkat Ali Ais: RM8.6"
Into seperate row:
- 2 x Brew Coffeee Panas: RM7.4
- 2 x Tongkat Ali Ais: RM8.6
And this 2 row into this table in DB:
Table: Products
Product Name | Quantity | Total Amount (RM) |
---|---|---|
Brew Coffeee Panas | 2 | 7.4 |
Tongkat Ali Ais | 2 | 8.6 |
*Note: the "total amount" substrings will reliably have a numeric value with precision to one decimal place.