我想选择除Top One之外的所有行,所以任何人都可以帮我解决这个问题。
答案 0 :(得分:9)
with cte as
(
select *, row_number() over (order by CustomerId) RowNumber
from Sales.Customer
)
select *
from cte
where RowNumber != 1
OR
select *
from
(
select *, row_number() over (order by CustomerId) RowNumber
from Sales.Customer
) tt
where RowNumber != 1
答案 1 :(得分:1)
SELECT * FROM table1
EXCEPT SELECT TOP 1 * FROM table1
答案 2 :(得分:0)
在SQL Server 2012中,您可以执行以下操作:
select * from TableName order by Id offset 1 rows