What is this query supposed to return?
Seems to be a single row per productid, but as ROWID without unique ordering is not reliable there's no guarantee for a consistent result set.
Or are table1 and table2 Derived Tables (Oracle calls them Inline Views) of the same table?
Then it's probably a simple
select * from tab
qualify row_number() over (partition by productid order by whatever_defined_max_rowid desc) = 1
Dieter
↧