小弟我想查找同一字段内 某几个特定的值 如何优化

WBOY
Release: 2016-06-13 10:33:39
Original
936 people have browsed it

我想查找同一字段内 某几个特定的值 怎么优化。
SELECT * FROM `tab` WHERE a3=1 or a3=2 or a3=3 or a3=4 or a3=5..........a3=29 a3=30

查找a3内值为1到30的。怎么优化的更简洁。高效一点

------解决方案--------------------
a3 in(1,2,3)
------解决方案--------------------
SELECT * FROM `tab` WHERE a3 between 1 and 30 ;

这样试试。或者 in(1,2..................)
------解决方案--------------------
楼上2种都好,过于10个还是用between 好些吧..

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!