Category export query

Category export query

Since there isn't an option to export the categorization list, can someone give me a SQL query to output the categories, subcategories and items with their correct hierarchy?

                  New to ADSelfService Plus?