Sunday, 11 August 2013

Join fields in the same table

Join fields in the same table

I have read a similar questions but it didn't work!
I Have a table like this:
ID IDParent Name
---------------------------
01 Parent
02 01 Child01
02 01 Child02
I Have to write a Query that returns the following table:
ID Name1 Name
---------------------------
01 Parent
02 Parent Child01
02 Parent Child02
I tried this query but it did not work:
SELECT * FROM SomeTable
JOIN SomeTable ON SomeTable.ID = SomeTable.IDParent;

No comments:

Post a Comment