I'm trying to get the most recent id
for every company_id
(as defined by the timestamp), I tried the below but it's multiple rows per company_id
...
SELECT id, MAX(created_timestamp), company_id
FROM company_status
WHERE active = 1
GROUP BY company_id, id
I can't do the GROUB BY
statement without id
because I get this error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lastone.company_status.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by