gpt4 book ai didi

php - SQL查询: Order In month

转载 作者:行者123 更新时间:2023-11-29 23:54:33 24 4
gpt4 key购买 nike

monthName   year    total

August 2014 10000
July 2014 20000
June 2014 56400
October 2015 20000
September 2014 23400
September 2015 10000

我想按如下所示的月份和年份顺序对以上数据进行排序

monthName  year    total

June 2014 56400
July 2014 20000
August 2014 10000
September 2014 23400
September 2015 10000
Octomber 2015 20000

顺序(一月、二月、三月这样以及2014年和2015年的数据)

我使用以下查询作为

从图表绘制组中选择 * 按月份名称

但我很喜欢

monthName   year       total

August 2014 10000
July 2014 20000
June 2014 56400
October 2015 20000
September 2014 23400

你能帮我解决这个问题吗?

最佳答案

SELECT * FROM chartdraw  ORDER BY DATEPART(MM, concat_ws(" ",monthname,year,01))

关于php - SQL查询: Order In month,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25439572/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com