0

困扰着你必须按类别和价格寻找的项目:我得到了以下mysql代码: $query = " SELECT * FROM filmi WHERE $id3 = '1' $orderby_query "

filmi是主表, $id3 = '1'是类别的副表。并且$orderby_query是按价格降序/升序的简单顺序

如何按价格范围搜索?在 10 到 100 之间?我不能用WHERE seriq BETWEEN 50000 AND 1000000 ORDER by seriq asc,因为已经到了:(

有什么建议么?

4

2 回答 2

1

试试这个

   WHERE $id3 = '1'
   AND seriq BETWEEN 50000 AND 1000000
   ORDER by seriq asc

或者像那样

   WHERE $id3 = '1'
   HAVING seriq >= 50000 AND  seriq <= 1000000
   ORDER by seriq asc
于 2013-02-09T20:46:50.923 回答
0

WHERE只需使用以下命令,您的条件中就可以包含多个子句AND

SELECT * FROM filmi
WHERE $id3 = '1' AND
   seriq BETWEEN 50000 AND 1000000
ORDER by seriq

祝你好运。

于 2013-02-09T20:24:06.187 回答