Hello the wonderful community,
I have a basic config MySQL / PHP with this DB :
- Pages Table
- Tags Table
- Pages_Tags Table
Query :
SELECT *, GROUP_CONCAT('tags_name')
FROM pages
LEFT JOIN pages_tags ON pages_tags.pages_id = pages.pages_id
LEFT JOIN tags ON tags.tags_id = pages_tags.tags_id
GROUP BY pages_tags.pages_id;
and i have the following error :
"Expression #1 of SELECT list is not in GROUP BY clause and contains
nonaggregated column this is incompatible with sql_mode=only_full_group_by"
So i made a lot of researches, and seems there are 2 solutions :
1/ To change the SQL mode 2/ To have the same column in the SELECT & GROUP BY.
Both seems bad solutions. The first because i don't want to change the default config and the second is insane, i need a lot of columns in the SELECT and not only the GROUP BY. Especially if the query is more complicated with a lot more LEFT JOIN. I need to display all theses infos.
Do you have any solutions ? Alternative with other methods ? I'm open to anything ;)
Thanks a lot !!