Thank you in advance!
the script is here:
(SELECT categoryId, NULL AS subCategoryId, categoryName, NULL AS subCategoryName, status AS cStatus, NULL AS sStatus FROM categories )
UNION
(SELECT c.categoryId as categoryId, s.subCategoryId as subCategoryId, c.categoryName as categoryName, s.subCategoryName as subCategoryName, c.status AS cStatus, s.status AS sStatus FROM categories AS c RIGHT JOIN subcategories AS s ON c.categoryId =s.categoryId)
ORDER BY categoryName, subCategoryName ASC

