Home > Backend Development > PHP Tutorial > 小弟我想查找同一字段内 某几个特定的值 如何优化

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:33:39
Original
1002 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
Latest Issues
The difference between href src url
From 1970-01-01 08:00:00
0
0
0
How to use laravel between
From 1970-01-01 08:00:00
0
0
0
The relationship between memory and data,
From 1970-01-01 08:00:00
0
0
0
The difference between icon and shorticon
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template