mysql按日期字段年月分组

select SUBSTRING(day,1,7),sum(gmv), sum(refund), sum(promotionFee) from tbl_complete_rate where storeID in(
66,
1003,
1006,
1007
) and day>='2025-01-01' and day<='2025-12-31'

group by

-- SUBSTRING(day,1,7)

DATE_FORMAT(day,'%Y-%m')

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: