change sql syntax to get subcategory