I am trying to get all rows which meets the parent child relation ship. for example
id Title parent_id
1200 A 1000
1201 B 1000
1202 C 1000
1203 D 1000
1204 E 1200
1205 F 1200
1206 G 1201
1207 H 1205
1208 I 1205
1209 J 1205
Now i have 1209 id, I want to retrieve all rows which satisfy parent child relation ship for 1209. Like here 1209 relates to 1205, 1205 relates to 1200, and 1200 relates to 1000.
I tried this query
SELECT * FROM `category` a left join category b on a.id=b.parent_id where a.id=1209
But this is giving me only one record. We are trying to get all rows which comes in this relationship.