日期:2014-05-17  浏览次数:20843 次

关于sql查询时两个字段怎么让它倒序显示
id是数值

我现在用的sql语句是:sql="select * from table where plshenhe=1 and id="&id

但是我要让查出来的数据以倒序显示应该怎么做。

要怎么加 order by id desc

菜鸟提问,高手勿砸!

------解决方案--------------------
比如你要对查出的数据按ID倒序,那就这样写
SQL code

SELECT ID,NAME,AGE FROM [TABLE] ORDER BY ID DESC

------解决方案--------------------
昏死了。。。。。

sql="select * from table where plshenhe=1 and contentid="&id&" order by ID desc"

这样
------解决方案--------------------
Uid是默认的序号,如果要实现倒序,应该选另一个与这个顺序关联的字段作为排序。