@gych That's exactly what ChatGPT wants me to do, but I get
SQLSTATE[42000]: Syntax error or access violation: 1055 'db.constants.value' isn't in GROUP BY (Connection: mysql, SQL: select `slug`, MAX(version) as max_version, `value` from `constants` group by `slug`)
@andyandy Ok, it's funny that ChatGPT gave you the exact same query. It seems to be caused by the 'value' column added to the select query.
This can be solved by removing 'value' from the first query and then adding it via an inner join query or by making a separate query after the first one to get the 'values' related to the initial results.