We are working on a project for school and have a small issue with a query. What we try to do is the following:
Select the education-unit(s)
with the same version_vid
and after that select the education-unit
with the latest version_date
.
But whatever we try, the education-unit
with the lowest euid
is returning.
We are using the Yii2 framework for this project, the ActiveQuery we use is:
EducationUnit::find()->groupBy('version_vid')->orderBy('version_date DESC');
SQL Fiddle: http://sqlfiddle.com/#!9/9929d/2/0
Thanks in advance!