I have a table containing items, some being children of others (I would say much like some kind of forum conversation, some are child of previous ones, some have no child, some have many children but there is only one level deep, there are no children of children), for example I get the following list after querying with some criteria, sorted by id's:

```
| id  | title | date       | childof |
| 002 | tit2  | 2017-02-23 | 000     | if 000, not a child
| 003 | tit3  | 2017-05-12 | 000     | not a child
| 004 | tit4  | 2017-03-25 | 002     | child of 002
| 005 | tit5  | 2017-03-26 | 002     | other child of 002
| 006 | tit6  | 2017-06-13 | 000     | not a child
| 007 | tit7  | 2017-07-06 | 003     | only child of 003

```

My question is about sorting/grouping the results: I would like to have the results listed as follow:

```
| id  | title | date       | childof |
| 006 | tit6  | 2017-06-13 | 000     | no child most recent at first level
| 003 | tit3  | 2017-05-12 | 000     | one child
| 007 | tit7  | 2017-07-06 | 003     | only child of previous
| 002 | tit2  | 2017-02-23 | 000     | two children
| 004 | tit4  | 2017-03-25 | 002     | child #1 of 002 oldest
| 005 | tit5  | 2017-03-26 | 002     | child #2 of 002 most recent

```

* by date (most recent first) for the first level (items that are not children)
* children being regrouped after their parent whatever their date but ordered with oldest first under the parent

My starting point was something like:

SELECT \* FROM mytable WHERE somecriteriaok ORDER BY date GROUP BY childof.

Of course I tried much more complicated solutions but cannot seem to achieve the above result so I tried to come up with this question trying to make it simple and clear ... hopefully I succeeded and will get some hints as where to go (excuse my english ...).

Pierre.