Help with only_full_group_by

i have this table wich contains id of a post and images linked to the post

i want to select only one image for each post id
i useally use this query : select dir,post from images group by post
but since i upgraded to mysql 5.7 this wont work because of only_full_group_by is enabled
i tried evry thing to disable but i failed

is there is equivalent query that do the same job ??

The solution is to use an aggegration function on the column(s) that are not in the group by clause. In your case that would be the ‘dir’ column. If you don’t care which image is returned, you could use the MIN() or MAX() function.

1 Like

that works just fine thank you :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.