6,129
社区成员
发帖
与我相关
我的任务
分享
SELECT *,记录总数据=(select count(1) from t where ROW >= 10 AND ROW < 20) FROM TEMP where ROW >= 10 AND ROW < 20
WITH TEMP AS(
SELECT *, ROW_NUMBER() OVER (order by proj_name,pdls_position) AS ROW
FROM (...) a )
WITH F AS
(SELECT * FROM TEMP where ROW >= 10 AND ROW < 20)
select count(1) from f
declare @t table (c int)
insert into @t
select 1 union all
select 2 union all
select 3 union all
select 4 union all
select 5 union all
select 6 union all
select 7 union all
select 8 union all
select 9 union all
select 0
select TOP 5 *,(SELECT COUNT(1) FROM @t) as total from @t
---------------
/*
1 10
2 10
3 10
4 10
5 10
*/