此问题已在此处有答案:
How do I select all the columns from a table, plus additional columns like ROWNUM?(4个答案)
20天前关闭。
我在Oracle中执行我在Postgres中创建的以下查询:
with FILTRADO_INICIAL as (
select *
from SUREM.tabs_values tv
where tv.affected = 1
and tv.incidents = 1
and tv.tab = 12
),
LAST_DATA as (
select case
when idrow is null THEN row_number() over (partition by affected, incidents, field, owner order by insert_date desc)
else 1
end as counter_field,
case
when idrow is null then null
else row_number() over (partition by affected, incidents, field, owner, idrow order by insert_date desc)
end as counter_row,
*
from FILTER_INITIAL
)
select *
from LAST_DATA
where (counter_field = 1 and counter_row is null)
or (counter_field = 1 and counter_row = 1)
然而,在Oracle中,它对我来说并不正确,告诉我我丢失了一个以* from FILTRADO_INICIAL
开头的表达式。有人知道问题出在哪里吗?
太感谢了
希望有人知道答案:)
1条答案
按热度按时间csga3l581#
在Oracle中,您需要用表名或别名 * 限定 * 星号:
完整代码: