I come up with this type of table after self Join
| BrandID | Brand | ParentBrandID | |
| 1 | HP | Null | |
| 8 | SONY-INK | 7 | |
| 3 | HP-Tonner | 1 | |
| 10 | SONY-Printer | 7 | |
| 7 | SONY | Null | |
| 2 | HP-INK | 1 | |
| 9 | SONY-TONER | 7 | |
| 4 | HP-Printer | 1 | |
But I am Looking for table Like below I mean first parents record and all their childs in sequence
| BrandID | Brand | ParentBrandID | |
| 1 | HP | Null | |
| 2 | HP-INK | 1 | |
| 3 | HP-Tonner | 1 | |
| 4 | HP-Printer | 1 | |
| 7 | SONY | Null | |
| 8 | SONY-INK | 7 | |
| 9 | SONY-TONER | 7 | |
| 10 | SONY-Printer | 7 | |
Could you send me code to get output like second one?