查询结果显示错误

时间:2014-09-28 10:14:28

标签: php mysql

我正在使用主要ID命令调用sql查询。

eg. "select product_id from products where order by product_id DESC"

这个查询给了我所有产品清单,但不是desc顺序,
它给了我像 PRODUCT_ID
1033
599个
587个
167个
1233
1224
像这样 每当我使用分页时,它会在第二页呼叫中给我更大的号码 谁能告诉我为什么会这样呢?

3 个答案:

答案 0 :(得分:0)

如果您添加WHERE关键字,则必须至少使用一个标准进行跟进。拿出来它应该有用。

答案 1 :(得分:0)

您的查询应如下所示:select product_id from products order by product_id DESC

如果您想添加某些条件,则必须在where column_name=criteria

之后指定

答案 2 :(得分:0)

如果您使用where clause,则必须至少给出匹配条件。如果您没有任何条件匹配do not use where clause

select product_id from products order by product_id DESC

如果你想使用where子句做这样的事情:

 select product_id from products where column_name='value for condition' order by product_id DESC