Home > Backend Development > PHP Tutorial > 同一表两个字段同时查询的有关问题

同一表两个字段同时查询的有关问题

WBOY
Release: 2016-06-13 12:11:09
Original
794 people have browsed it

同一表两个字段同时查询的问题
有表table,两个段,field1,field2
数据
field1  field2
中华    人民共和国
请问要怎么才能使得搜索"中华人民"的时候两个字段都满足呢?
现在就只会 field1 like '%中华%' 和 field2 like '%人民%'
------解决思路----------------------
field1 like '%中华%' and field2 like '%人民%'

concat(field1, field2) like '%中华人民%'

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