If it is a fixed text excerpt:
If it is purely text replacement it will be the same problem as I I replied here .
Use Replace
to replace this part of content.
It would look like this:
UPDATE produtos
SET obs= REPLACE(obs, '<p><a target="_blank" href="/uploads/docs/58e7a4fd05ca6.pdf "><img alt="" style="width: 175px; height: 45px;" src="/uploads/imagens/59d292393a88f_900x.jpg" /></a></p>', '')
WHERE obs LIKE '%<p><a target="_blank" href="/uploads/docs/58e7a4fd05ca6.pdf "><img alt="" style="width: 175px; height: 45px;" src="/uploads/imagens/59d292393a88f_900x.jpg" /></a></p>%'
If the content of P is variable
You can use a combination of SUBSTRING
with INSTR
:
UPDATE produtos
SET obs = SUBSTRING(obs, 0, INSTR(obs,'<p>')) + SUBSTRING(obs, INSTR(obs,'</p>'))
WHERE obs IS NOT NULL AND
INSTR(obs, '<p>') >=0 AND
INSTR(obs, '</p>') >=0
SUBSTRING
in syntax SUBSTRING( str, inicio, quantidade)
will return [ quantidade
] characters from position [ inicio
] of string [ str
]
In the SUBSTRING( str, inicio )
syntax, the function returns all characters of [ str
] from position [ inicio
].
The function INSTR
- INSTR( str, strProcurada)
- a value greater than or equal to zero corresponding to the initial position index of the string str
where the text strProcurada
is found.
If there are multiple P nested in the column and you want to remove a specific
You can do this from regular expressions ( REGEXP
). But for specific replies, we would have to know what the basic code structure is looking for.
I hope I have helped.