At 3.22.1 I have a GeoPackage attribute table containing the string field: box_id and the date field: inspection_date. The table rows look like:
box_id inspection_date
NE_01_01 2021-05-01
NE_01_01 2021-05-02
NE_01_01 2021-05-04
SE_03_02 2021-06-09
SW_01_04 2021-06-05
SW_01_04 2021-06-07
...
I need to select those records with the latest inspection_date for each box_id. Using my example data, the resulting selection would look like:
box_id inspection_date
NE_01_01 2021-05-04
SE_03_02 2021-06-09
SW_01_04 2021-06-07
...
I have tried this selection expression:
"inspection_date" = maximum("inspection_date", group_by:="box_id")
but it returns zero records.
What am I doing wrong?
NOTE:
Following the answer by Kadir Sahbaz, I did some experimentation and found that converting inspection_date from a date type to a string type also worked:
"inspection_date" = maximum(format_date("inspection_date", 'yyyy-MM-dd'), group_by:="box_id")
Apparently maximum() requires a string type, not a date type.

