I have a database field with dates and times that looks like this
2018-10-29 01:16:28
2018-10-25 22:58:34
2018-10-18 16:59:27
I have a database query that I would like to make only get the distinct year portion of each row, but can not seem to make it do that, so I am just querying the entire date.
I have then added a formatter to it of EnquiryDateSubmitted.getYear(EnquiryDateSubmitted)
Which then returns about 2000 entries where 2018 is repeated 300 times.
I need something like .unique added to the list, but i can not use .unique unless the returned data is an array, so I would like to do something like
EnquiryDateSubmitted.getYear(EnquiryDateSubmitted).toArray().unique
Which obviously does not work
Does anyone have any idea of how i can do this other that creating a view in MySQL with the date already stripped into just the year portion.
Last updated: