Hi,
TheĀ row_number() approach is slower.
The inner query by itself (the one you posted above) takes around 1 sec.
The whole temporary table creation and query execution that I showed before takes almost half of it so, I'd rather stick with that.
The only problem is that I can't use it as a subquery, I need to use an indermediate variable in between.
Is there any way to "delete" the variable after I use it ? I know its lifetime is up to the end of user session but are there any other options ? I didn't see anything in the manual.
If I won't find any workaround I'll declare a stored procedure.
Cheers,
Dimitris