我有以下列在SQL Server 2008中的表t_list
:
firstid, firstpoints, secondid, secondpoints
如何执行这样的查询?
我想在一个SQL查询,但以特定的方式,以选择那些列。
我要选择那些列的前400名,由firstpoints
只为firstid
列排序,并secondpoints
只为一个查询secondid
列,例如:
SELECT TOP 400 firstid, firstpoints
FROM t_list
ORDER BY firstpoints desc
和
select top 400 secondid, secondpoints
FROM t_list
ORDER BY secondpoints desc
如何将上述两个查询合并为一个查询,返回输出如
firstid, firstpoints, secondid, secondpoints
1. firstidresult, firstpointresult, secondidresult, secondpointsresult
2. etc...