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

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

WBOY
Release: 2016-06-23 13:43:52
Original
1165 people have browsed it

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


回复讨论(解决方案)

field1 like '%中华%'  and field2 like '%人民%'

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

field1 like '%中华%'  and field2 like '%人民%'

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


谢谢,神一样的人物
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