甲骨文 11g
我想将 max(rownum) 作为新列包括在内以获得所需的结果。本质上,我想将此QueryA的结果作为新列添加到QueryB。 当我在 QueryB 中包含 max(rownum) 时,我得到一个“不是单组函数”。当我按可乐或 rownum 分组时,QueryB 也不起作用。
查询A
with data_row as
(
select 1 as col_a from dual union all
select 2 as col_a from dual union all
select 3 as col_a from dual )
select max(rownum) as max_row from data_row
查询B
with data_row as
( select 1 as col_a from dual union all
select 2 as col_a from dual union all
select 3 as col_a from dual)
select col_a, rownum from data_row
期望的结果
Col_a Rownum MaxRowNum
--------------------------------
1 1 3
2 2 3
3 3 3