在结果= 1到100之间选择数据库中的所有数据

时间:2013-03-04 00:56:18

标签: php

我在向表中选择数据并回显例如

--------------------------------------
id   |   bought   |   customerName    | 
--------------------------------------
1    |     70     |  customer 1       |
2    |     20     |  customer 2       |
3    |     50     |  customer 3       |
4    |     30     |  customer 4       |
5    |     80     |  customer 5       |
6    |    100     |  customer 6       |
--------------------------------------

我想要做的是通过购买订购并选择50到100之间购买的产品

customer 3 --- 50
customer 1 --- 70
customer 5 --- 80
customer 6 --- 100

2 个答案:

答案 0 :(得分:1)

您可以尝试此选择数据

"SELECT * FROM table_name WHERE bought BETWEEN 50 AND 100 ORDER BY bought ASC"

答案 1 :(得分:0)

试试这个

  

SELECT * FROM table_name WHERE购买了50和100 ORDER BYDER购买ASC