<code> select ROW_NUMBER() OVER(ORDER BY ID) AS ROWNUM from (select s.ID from staff as s union all select s2.ID from staffg as s2 ) as M where ROWNUM >= 5 AND ROWNUM <= 10 ; </code>
以下のようにエラーがでてしまいます。
SQL0206N "ROWNUM" is not valid in the context where it is used. SQLSTATE=42703
<code>
select ROWNUM from(
select ROW_NUMBER() OVER(ORDER BY ID) AS ROWNUM from (select
ID
from staff
union all
select
ID
from staffg
))
where ROWNUM >= 5
and ROWNUM <= 10
;
</code>