Hi guys, I have a field in a table which stores strings. The format is: productName <font color=red>()</font>. </font> is the end of the string. My question is, how I can delete the substring starting from <font color=red> to the end of the entire string. Any idea?
I have sth like this:
SELECT SUBSTRING_INDEX((select field from table where id=sth), 'font', -2)
it returns "color=black>(blah)</font>"
See if this works:
SELECT SUBSTR(field, 1, INSTR(field, '<font') - 1) AS something;
Thank you Installer, that sql command actually returns the entire string BEFORE "<font color". That's good enough
That's what you asked for:
funksoul wrote:...delete the substring starting from <font color=red> to the end of the entire string.
...delete the substring starting from <font color=red> to the end of the entire string.
If that does indeed give you what you wanted, don't forget to mark this thread resolved.