SQL grouping by month and year

后端 未结 9 1754
旧时难觅i
旧时难觅i 2020-11-27 15:57

I\'m not sure what should I write in the following SQL query to show \'date\' column like this: \"month-year\" - \"9-2011\".

SELECT MONTH(date) + \'.\' + YE         


        
9条回答
  •  佛祖请我去吃肉
    2020-11-27 16:24

    I guess is MS SQL as it looks like MS SQL syntax.

    So you should put in the group line the same thing as in select ex:

    Select MONTH(date)+'-'+YEAR(date), ....
    ...
    ...
    ...
    group by MONTH(date)+'-'+YEAR(date)
    

提交回复
热议问题