Hello,
I have a little problem with a query Im trying to make with the query builder :
So basically I have a table with some employee's ids, a counter, and a date (which is the year)
what I want is getting the last available year for each employee in one Query.
I have managed to do it in raw mysql it looks like this :
SELECT * from compteur_conges inner join (
SELECT employe_id, MAX(year) AS year
FROM `compteur_conges`
WHERE employe_id IN (".$idListString.")
GROUP BY employe_id
) as a
on a.employe_id = compteur_conges.employe_id
and a.year = compteur_conges.year
The problem I have is that I don't know on how to make a subquery with the query builder with ON this AND that (employe_id and year in this case).
If anyone knows how to do this that would be a great help ! Or if you have a complete different idea on how to do it, i am open to suggestions !
++