Home > Backend Development > PHP Tutorial > mysql查询语句,搞了一个小时也没解决

mysql查询语句,搞了一个小时也没解决

WBOY
Release: 2016-06-13 12:06:32
Original
986 people have browsed it

mysql查询语句,急,弄了一个小时也没解决
数据库mysql
表tb,有一个title字段
有一条记录为“峨眉山、乐山品质二日游 ”
另一条记录为“上海二日游 ”

有一固定字符串为"峨眉山,上海,成都,乐山,北京”
请问要怎么写一条语句能够查询诸如title字段包含有"峨眉山 or 乐山",或"上海"。
select * from tb where ??
------解决思路----------------------
select * from tb where title REGEXP '峨眉山
------解决思路----------------------
上海
------解决思路----------------------
成都
------解决思路----------------------
乐山
------解决思路----------------------
北京'

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