我有一个名为person.sql的表
======================================
id name address
1 jhon CA
2 alex FL
3 adam NY
4 max SF
5 robert AL
6 mat AK
7 emet CO
8 frank HI
9 ian IL
10 fredy KS
===================================我的问题是,如果我只想得到像1 2 5 8 10这样的id,我不能使用where id来获得服装行,该如何实现呢?
im正在使用此查询,但返回为空
SELECT * from tbl person where id='1' AND id='2' AND id='5' AND id='8' AND id='10'请帮助我:(
发布于 2016-03-23 16:14:39
您需要搜索id在集合中的位置,因此: SELECT * FROM table WHERE id IN (1,3,5,8)
发布于 2016-03-23 16:10:43
SELECT * from tbl person where id='1' OR id='2' OR id='5' OR id='8' OR id='10'https://stackoverflow.com/questions/36172739
复制相似问题