I have a table with a list of pages, some with parent pages. These pages are in a very random order. I need to make a recursive join statement to select all pages ordered by Page_Order, where the parents are listed each followed by its child pages.
Table: Pages
Page_ID | Page_Name | Page_Parent | Page_Order
1       | User      | 2           | 2
2       | Admin     | NULL        | 2
3       | Pages     | 2           | 1
4       | Home      | NULL        | 1
5       | About     | NULL        | 3
6       | Contact   | 5           | 1
I want to select them in the following order (order the parent pages, each followed by its child pages):
Page_ID | Page_Name | Page_Parent | Page_Order
4       | Home      | NULL        | 1
2       | Admin     | NULL        | 2
3       | Pages     | 2           | 1
1       | User      | 2           | 2
5       | About     | NULL        | 3
6       | Contact   | 5           | 1
 
    