I have a problem with my query and mysql throws the following error:
#1055 - Expression #66 of SELECT list is not in GROUP BY clause and contai
If you want to use GROUP BY on specific column and get the id's of the results there is one nice trick how to do it:
SELECT `distinct_column`, MAX(`id`), MAX(`another_int_column`) FROM `table_name` GROUP BY `distinct_column`
Result:
distinct_column id another_int_column
Abertamy 13579 11
Adamov 17765 14
Adolfovice 2924 3
Achotín 2241 2
Babice 17772 14
Now you have distinct values from distinct_column and with it the values of the corresponding row.
source
I think that the id and another_int_column have to be unique, but i'm not sure.