M
M
Mr. Smith2022-03-12 00:00:29
MySQL
Mr. Smith, 2022-03-12 00:00:29

How to delete a row in a table using only the beginning and end of the text?

There is a dle_post table and a descr column with a description of the news, in all descriptions there is a line that is repeated, but inside it the product name is different.
Example:

We bake the best cherry bread in the country.

This phrase is repeated in all the news, only the name " Cherry " changes.
An example in the screenshots, now like this:
622bcb1dd1cdd362794724.png
And you need to do this:
622bcb3684b78311961198.png
What sql query is needed to remove a line along with the title from all news?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2022-03-12
@MrSS

Just use the LIKE operator

delete from news where description like 'Мы печем лучший % хлеб в стране.';

SQL LIKE online

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question