如下语法: SELECT COUNT() AS 人数, 场次
FROM Table_1
GROUP BY 场次
ORDER BY 人数 DESC
select from product where id =5
union
select from product where id =4
union
select from product where id =6
union
select from product where id =100
……
这个可用,就是效率差点~
可以增加一个字段,比如N,对应5,4,6,100,798,1,43,65,12分别添加值为1-9个数字,然后再用这个字段排序即可。order by n~
sql
使用order
by
排序
select
from
table
order
by
value1,value2
根据字段value1和value2排序默认是升序
select
from
table
order
by
value1,value2
desc
按照降序排序
以上就是关于关于数据库的直接写出并运行select语句,查询每一场次的人数,并按人数从达到小排序全部的内容,包括:关于数据库的直接写出并运行select语句,查询每一场次的人数,并按人数从达到小排序、数据库排序问题 select * from product where id in(5,4,6,100,798,1,43,65,12)、数据库查询时怎么按照多个字段进行排序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)