SQL IN 问题

WBOY
Release: 2016-06-23 13:31:13
Original
973 people have browsed it

id值50
where id in (50) 就正常

但是当 id值50,51,52
where id in (50) 就搜索不出来
where id in ('50')  也不行
如何解决


回复讨论(解决方案)

like 或者 find_in_set 都可以。

select * from tb where id like '%50%'

或者

select * from tb where find_in_set('50',id)

like 或者 find_in_set 都可以。

select * from tb where id like '%50%'

或者

select * from tb where find_in_set('50',id)



用like不准确,比如查询的是5,而不是50,就错了

find_in_set 没用过,准确吗

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!