I have a table with following dataset
id name parent
------------------
1 xyz NULL
2 def NULL
3 mno abc
4 abc NULL
5 pqr abc
6 qfx def
I would want to fetch the data in the following order:
1 abc NULL
3 mno abc
5 pqr abc
2 def NULL
6 qfx def
4 xyz NULL
What I mean is ORDERing has to occur by Username but records with same parent must show together and just below the record for the parent.
I am using MySQL.
try this new answer:
it concatenated the two strings so it should order like this: