How can I use the value from one query into the second one. I tried with an alias "papa" but I read that the order of executions makes the alias not available to the second query.
What would be the appropriate way of achieving something like below ?
select id, name, parent_id as papa, (select name from people where id = papa)
from people;
2
Answers
Make the alias earlier
I would use a self join for this:
Online example