Here’s an Oracle version of the same query:
select data.*
, derived_table.position
from data
, (select a.id, sum(nvl(b.length, 0)) position
from data a
, data b
where b.id(+) < a.id
group by a.id
) derived_table
where data.id = derived_table.id
Oracle uses NVL instead of COALESCE, and its own join syntax instead of ANSI-92 joins, but the concepts are the same.
§
I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)
§
© 2001–9 Mark Pilgrim