4you
еееххххх....
Запрос. в чем разница межде PostgreSQL и MySQL?
Ув. знатоки.
В постгре новичок. Подскажите в чем разница между PostgreSQL и MySQL?
Имею запрос:
SELECT t1.group_id,t1.name_en,t1.sort_index,COUNT(t1.group_id) AS total,t1.sub_group,t2.event,t3.game FROM groups AS t1 LEFT JOIN events AS t2 ON t1.group_id=t2.group_id LEFT JOIN games AS t3 ON t2.event=t3.event WHERE t2.event IS NOT NULL AND t3.game IS NOT NULL AND t1.view_type IN ('2','4') AND (t2.view_type IN ('2','4') AND t2.status='0' AND t2.start>NOW()) AND (t3.game_type IN ('1','3','4') AND t3.view_type IN ('2','4') AND t3.status=0 AND t3.stop>NOW()) GROUP BY t1.group_id ORDER BY t1.sort_index DESC,t1.sub_group,t1.group_id
который отлично отрабатывает в MySQL, а в PostgreSQL вываливается с ошибкой:
ERROR: column "t1.name_en" must appear in the GROUP BY clause or be used in an aggregate function
Я думал что SQL везде един...
Ув. знатоки.
В постгре новичок. Подскажите в чем разница между PostgreSQL и MySQL?
Имею запрос:
SELECT t1.group_id,t1.name_en,t1.sort_index,COUNT(t1.group_id) AS total,t1.sub_group,t2.event,t3.game FROM groups AS t1 LEFT JOIN events AS t2 ON t1.group_id=t2.group_id LEFT JOIN games AS t3 ON t2.event=t3.event WHERE t2.event IS NOT NULL AND t3.game IS NOT NULL AND t1.view_type IN ('2','4') AND (t2.view_type IN ('2','4') AND t2.status='0' AND t2.start>NOW()) AND (t3.game_type IN ('1','3','4') AND t3.view_type IN ('2','4') AND t3.status=0 AND t3.stop>NOW()) GROUP BY t1.group_id ORDER BY t1.sort_index DESC,t1.sub_group,t1.group_id
который отлично отрабатывает в MySQL, а в PostgreSQL вываливается с ошибкой:
ERROR: column "t1.name_en" must appear in the GROUP BY clause or be used in an aggregate function
Я думал что SQL везде един...