Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 T-SQL 中编写一个存储过程,以返回文章表中评分最高的 5 篇文章和评分最低的 5 篇文章,由“评分”列确定。
我正在考虑在两个选择上使用联合,但我不确定如何编写它。
select * from (select top 5 *, 'Bottom Five' as Ranking from Call order by id ) a union all select * from (select top 5 *, 'Top Five' as Ranking from Call order by id desc ) b