答案 0 :(得分:0)
您可以执行以下操作,但仅应出于显示目的:
WITH a (ename, position, deptno) AS (SELECT 'KING', 'Manager', 10 FROM dual
UNION ALL
SELECT 'BLAKE', 'Manager', 30 FROM dual
UNION ALL
SELECT 'CLARK', 'Manager', 10 FROM dual
UNION ALL
SELECT 'ALLEN', 'Manager', 30 FROM dual
UNION ALL
SELECT 'WARD', 'Manager', 30 FROM dual)
SELECT ENAME
, CASE WHEN position = MAX(position) over (ORDER BY ROWNUM
ROWS BETWEEN 1 preceding AND 1 preceding)
THEN NULL
ELSE position
END position
, deptno
FROM a
如果值与上一行相同,则将在列NULL
中显示POSITION
。