Home > Backend Development > PHP Tutorial > cate_no 值是 6,2,9,13,19 ,WHERE cate_no in (6,7,8),该如何处理

cate_no 值是 6,2,9,13,19 ,WHERE cate_no in (6,7,8),该如何处理

WBOY
Release: 2016-06-13 11:15:21
Original
766 people have browsed it

cate_no 值是 6,2,9,13,19 ,WHERE cate_no in (6,7,8)
member 表里
有一个字段叫
cate_no
是字符串类型。
cate_no 值是 6,2,9,13,19 的时候(数字顺序是乱序的)。

SELECT * FROM member WHERE cate_no in  (6,7,8)

这时搜索不到这个数据,
但是
SELECT * FROM member WHERE cate_no in  (6)
时能搜索到这个数据,

cate_no in   (6,7,8)
这个MYSQL代码怎么写?


------解决方案--------------------
<br />SELECT * FROM `member ` WHERE FIND_IN_SET(6,cate_no) OR FIND_IN_SET(7,cate_no) OR FIND_IN_SET(8,cate_no)<br />
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