Writing SQL query to not show empty categories