SQL怎样把查出来的结果集再倒序查询

SQL怎样把查出来的结果集再倒序查询,第1张

if object_id('tb') > 0 drop table tb

go

create table tb (sid int)

insert into tb select '1'

union all select '2'

union all select '3'

union all select '4'

union all select '5'

union all select '6'

union all select '7'

union all select '8'

union all select '9'

union all select '10'

select from (select top 5 from tb) t

order by tsid desc

楼主直接给分吧、哈哈!

id倒叙输出数据么,一条sql语句就可以了。

$con = mysql_connect('服务器ip','user','pwd');

mysql_select_db('database',$con);

mysql_query('SET NAMES UTF8');

$sql = 'select from table order by id desc';

$res = mysql_query($sql);

按id号从小到大排列

sql = "select from tablename order by id asc"

按id号从大到小排列

sql = "select from tablename order by id desc"

以上就是关于SQL怎样把查出来的结果集再倒序查询全部的内容,包括:SQL怎样把查出来的结果集再倒序查询、php查找数据库的内容,怎么以ID的倒序输出、怎么让数据库展示的数据是倒序排列等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9612024.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-30
下一篇 2023-04-30

发表评论

登录后才能评论

评论列表(0条)

保存