I have a query where I do a group by on a version field.
The thing is I want to select the record with the highest version number (aka most recent record).
This is what my database looks like:
productinformation:
productinformation_content:
This is what my query looks like:
SELECT *
FROM productinformation
LEFT JOIN productinformation_content
ON productinformation_content_sourceid = productinformation_id
WHERE productinformation_content_lang = 'en' AND
productinformation_content_active = 1
GROUP BY productinformation_content_sourceid
ORDER BY productinformation_content_title ASC
There can be multimple records with the same productinformation_content_sourceid so I grouped on that field but I need the record with the highest productinformation_content_version of that group
Can anyone help me out?
Any help is highly appreciated.