Mysql query example:
SELECT a1.* FROM agreement a1 LEFT JOIN agreement a2 on a1.agreementType = a2.agreementType and a2.id > a1.id WHERE a2.id is null
The purpose of the request is to obtain the last consent of the return type. There are many types, and I only need a list of each last convention for each type. My sample query above works as expected, but does not go to DQL.
How can I do this in DQL, given that I don't have a column that refers to itself? Note that "agreementType" is also a foreign key for another table.
source share