I have a table that has a field with parent ID. Children and parents are in a table Example:
id | Name | Sub. Status
I have to get all the records with parents (parents and children separately). Therefore, if I search the category with id = 4, then i would like to get the record with id = 4 and record the id equal to the child sub.
Example:
id | Name | Sub. Status ------------------------------- 1. Electronics | 0 | 1 2 | Sports | 0 | 1 3 | TV | 1 | 1 4 | LCD | 3 | 1
Therefore, I need 3 records with ID: 4, 3 and 1 (with parents' parents).
My query is very complex, I have a lot of
thanks for your help.
Comments
Post a Comment