i want to select all the row except the Top One so can anybody help me on this Query.
sqserrrh1#
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
avwztpqn2#
In SQL Server 2012, you can do this:
select * from TableName order by Id offset 1 rows
gojuced73#
SELECT * FROM table1 EXCEPT SELECT TOP 1 * FROM table1
uqdfh47h4#
If id attribute is known than we can use..
id
SELECT t1.* FROM table t1 LEFT JOIN ( SELECT id FROM table LIMIT 1 ) t2 ON t1.id = t2.id WHERE t2.id IS NULL;
4条答案
按热度按时间sqserrrh1#
OR
avwztpqn2#
In SQL Server 2012, you can do this:
gojuced73#
uqdfh47h4#
If
id
attribute is known than we can use..