php mysql finds a string in a field

WBOY
Release: 2016-09-19 09:16:46
Original
1103 people have browsed it

Suppose I want to find a certain string in a field in mysql
Which function should I use? For example,
"owogkwoeag 190 wegaweogkawoeg" "owogkwwegawegoeag 190 wegaweogkawoeg" "owogkwesseseryeag 190 wegaweogkawoeg" I want to find 190
As long as it contains 190 I deleted him
It can only be 190
If 19 or 910 or 91 does not count...

Reply content:

Suppose I want to find a certain string in a field in mysql

Which function should I use? For example,
"owogkwoeag 190 wegaweogkawoeg" "owogkwwegawegoeag 190 wegaweogkawoeg" "owogkwesseseryeag 190 wegaweogkawoeg" I want to find 190
As long as it contains 190 I deleted him
It can only be 190
If 19 or 910 or 91 does not count...

If you don’t want to use

LIKE

for fuzzy query, you can use the LOCATE() or POSITION() function to implement it. Suppose your table

test

is:

id1234You can use the following statement to delete all records with
content
owogkwoeag 190 wegaweogkawoeg
owogkwwegawegoeag 190 wegaweogkawoeg
owogkwesseseryeag 190 wegaweogkawoeg
qweqweqweqweqwe 901
190

in the content field in the test table:

<code class="sql">delete from test where LOCATE('190', content);</code>
Copy after login
or

<code class="sql">delete from test where POSITION('190' IN content);</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!