寻找像
这样的东西Select * FROM 'database' WHERE id = 1-40
我可以通过1到40之类的数字选择一个数字
多个数字选择语句sql
答案 0 :(得分:2)
SELECT * FROM database_table WHERE id BETWEEN 1 AND 40
这是您可以使用的示例页面:http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_between
答案 1 :(得分:0)
between
运算符是您正在寻找的内容:
SELECT * FROM `database` WHERE id BETWEEN 1 AND 40
答案 2 :(得分:0)
尝试:
Select * FROM `tablename` WHERE id >= 1 AND id <= 40
答案 3 :(得分:0)
在DB中选择范围的两种可能方式:
Select * FROM `database.tablename` WHERE id BETWEEN 1 AND 40 ;
或
SELECT * FROM `DATABASE.TABLENAME` WHERE ID >= 1 AND <=40;
如果您想要选择多个不在范围内的项目,您可以使用:
Select * FROM `database.tablename` WHERE id in (1,2,3,4,5,6.....40);