更新时间:2023-01-29 21:19:33
只需将ORDER BY放在最后,就像
Just put ORDER BY at the end, Like
Order By MONTH(invoicedate)
这样,无论年份如何,都可以通过对月份进行排序来获得数据,但是如果要在Year中对月份进行排序,则可以使用下面的语法
That will give you data by sorting month wise regardless of year but if you want to sort month among Year then you can use below Syntax
Order By YEAR(invoicedate),Month(invoicedate)
希望它对您有用.
Hope it will work for you.