I have a table with descriptions of products. Within those descriptions are product dimensions, though not all in the same position.
How can I pull out just the widths in numbers from the following example data Description
- Table Width (cm) 100
- Bed, Width: 90cm
- Office Desk Width - 200 cm. Color - Black
- Couch with Width of 500 cm
- Chair - width(50.5cm)
Have used substring_index function to get the text between 'width' and 'cm', but haven't been able to grab then just the numbers within that. (and that doesn't work for record 1 above
SELECT description, substring_index(substring_index(description, 'width', -1),'cm', 1)
FROM productlisting
Expected output:
- 100
- 90
- 200
- 500
- 50.5
Actual
- : 90
- 200
- of 500
- (50.5