WITH CTE(MISSNO, MAXID) AS (SELECT 1 AS MISSNO,
(SELECT MAX(EID) AS Expr1
FROM EMP6) AS MAXID
UNION ALL
SELECT MISSNO + 1 AS Expr1, MAXID
FROM cte AS cte_2
WHERE (MISSNO < MAXID))
SELECT MISSNO, MAXID
FROM CTE AS CTE_1
(SELECT MAX(EID) AS Expr1
FROM EMP6) AS MAXID
UNION ALL
SELECT MISSNO + 1 AS Expr1, MAXID
FROM cte AS cte_2
WHERE (MISSNO < MAXID))
SELECT MISSNO, MAXID
FROM CTE AS CTE_1
No comments:
Post a Comment