select value from students where coll_Id=1
select value from students where coll_Id=2
select value from students where coll_Id=3
select value from students where coll_Id=4
select value from students where coll_Id=5
select value from students where coll_Id=6
select value from students where coll_Id=7
select value from students where coll_Id=8
select value from students where coll_Id=9
select value from students where coll_Id=10
如何为上述语句编写单个查询。
答案 0 :(得分:4)
select value from students where coll_Id in (1,2,3,4,5,6,7,8,9,10);
编辑://见@ t-clausen.dk的问题评论
如果你总是处理范围,你可以使用
select value from students where coll_Id between 1 and 10;
相当于
select value from students where coll_Id >= 1 and coll_id <= 10;