如何在MYSQL查询中的where条件中使用循环?

时间:2013-12-06 04:39:20

标签: sql-server-2008

select * from student where roll-no in (30 to 50)

student是表名,roll_no, first_name, last_name, add是列

如何打印30到50之间的学生资料?

2 个答案:

答案 0 :(得分:1)

您需要使用where子句,其范围如下:

 select * from student where [roll-no] >= 30 and [roll-no] <= 50;

答案 1 :(得分:0)

 select * from student 
 where roll-no between 30 and 50