suppose I have tree table
h y t
------- ----- ------------
id id id name
------- ----- ------------
1 1 1 john
2 2 2 alex
3 8 6 maggie
and I have a query like this:
select t.*,(select y.id from (select * h where h.id > t.id) y) t
problem is I can't use t.id in inner query. I want to know what is the problem and what is the solution?
i'm using this query in oracle 11g
from, and the data impliesyis a separate table, not just an inline view. Can you clarify the example? Is there a reson you're using subqueries instead of joins - do you think it's necessary for your real, presumably more complicated, query?