Due to some restrictions by my client, I need to do this thing within a single mysql query.
I have a varchar field, with value like: 3,050 wheels
I have another integer field, with value: 2
I need the query to return me 6,100 wheels.
I can probably use CONVERT to convert the 3,050 to number, but I don’t know how to find the index of " ", moreover the output again needs to be formatted with a comma and concatenated back with the string(non-numeric) portion.
Please help.
Use
SUBSTRING_INDEXto select the appropriate part of the string, andFORMATto convert the number back to a string.All the functions are described here.