以下は、前の行を取得するために ORACLE で記述されたクエリであり、最後に出力されます。MS AccessでORACLEクエリの下にフレームを作成する方法、特にROWNUM部分..入力に感謝します
orcl> WITH d
2 AS (SELECT ROWNUM rn,
3 dname,
4 deptno
5 FROM (SELECT dname,
6 deptno
7 FROM dept
8 ORDER BY dname)),
9 e
10 AS (SELECT ROWNUM + 1 rn,
11 dname,
12 deptno
13 FROM (SELECT dname,
14 deptno
15 FROM dept
16 ORDER BY dname))
17 SELECT rn,
18 d.dname,
19 d.deptno this_row,
20 e.deptno previous_row
21 FROM d
22 left outer join e USING (rn)
23 ORDER BY dname;
RN DNAME THIS_ROW previous_ROW
1 ACCOUNTING 10
2 OPERATIONS 40 10
3 RESEARCH 20 40
4 SALES 30 20