我有一个 SqlServerSELECT
DECLARE @offset INT;
DECLARE @limit INT;
WITH cte
AS (SELECT t.*,
Row_number() OVER (ORDER BY Id) AS RowNum
FROM (SELECT *
FROM Table1
UNION
SELECT *
FROM Table2) t)
SELECT *
FROM cte
WHERE RowNum BETWEEN @offset AND @offset + @limit
如果没有 WHERE 条件,我如何知道限制的总行数RowNum BETWEEN @offset AND @offset + @limit