query for fetching parent/child records in a single row
Hi,
I want to fetch both the parent and child records in a single row .
PFB the query for the same.
With this query iam able to get the record in a single row, but in my case
the dept and year are optional, so there will not be any data in table ,
so if i fetch , it should retreive as null for that particular field.
select one.name college, two.name student, three.name dept , four.name year from test4 one, test4 two, test4 three, test4 four where two.parentid = one.id and three.parentid = two.id and four.parentid = three.id
I tried using or/join clause, but did not work.Please suggest.
Regards,
Subha
|