This is my table:
CREATE TABLE t (id INT, parent INT, FOREIGN KEY(parent) REFERENCES t(id));
This is a collection of data I have:
id parent
1 NULL
2 NULL
3 1
4 1
I would like to select them and order like this:
id parent
1 NULL
3 1
4 1
2 NULL
I can't find a proper way to do it (in MySQL 5+). Please help, thanks!