关于数据库的直接写出并运行select语句,查询每一场次的人数,并按人数从达到小排序

关于数据库的直接写出并运行select语句,查询每一场次的人数,并按人数从达到小排序,第1张

如下语法: 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)、数据库查询时怎么按照多个字段进行排序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存