select
t1.email as parent_email,
t2.email as email,
t2.password as password
from my_table t1
left join (
select
parrent_id,
email,
password
from my_table
where parrent_id is not null
) t2 on t2.parrent_id = t1.parrent_id
where t1.parrent_id is null
order by t1.email