E.g.:
EXTRACT (YEAR from “EventDate”) || ‘-’ || EXTRACT (MONTH from “EventDate”) “YearMonth” … ORDER BY “YearMonth”
This gives incorrect order, e.g.:
2018-10
2018-3
2019-4
Wanted:
2018-03
2018-10
2019-04
I expect the solution is simple but I cannot fathom it from the Firebird manual. All help gratefully received.
Hello,
This should work:
Select Extract(YEAR from "EventDate") || '-' || RIGHT('0' || trim(EXTRACT(MONTH from "EventDate")), 2) "YearMonth" from "YOUR_TABLE_NAME" Order by "YearMonth"
Ratslinger, once again to the rescue. It works! Great! Thank you!