MySQL ERROR:

Error Number: 3065

Description: Expression #1 of ORDER BY clause is not in SELECT list, references column 'chiro_db.exp_categories.group_id' which is not in SELECT list; this is incompatible with DISTINCT

Query: SELECT DISTINCT(exp_categories.cat_id), parent_id FROM exp_categories LEFT JOIN exp_category_posts ON exp_categories.cat_id = exp_category_posts.cat_id LEFT JOIN exp_weblog_titles ON exp_category_posts.entry_id = exp_weblog_titles.entry_id WHERE group_id IN ('3') AND exp_category_posts.cat_id IS NOT NULL AND exp_weblog_titles.status != 'closed' AND exp_weblog_titles.entry_date < 1591019302 AND (exp_weblog_titles.expiration_date = 0 || exp_weblog_titles.expiration_date > 1591019302) AND parent_id = 0 ORDER BY group_id, parent_id, cat_order