skh*_*ams 3 mysql sql group-concat
我需要排序date的concat范围内group_concat,而我的查询运行良好:
SELECT
report.`Name`,
GROUP_CONCAT(
CONCAT(
"[",
DATE(report.Date) --(not working) order by DATE(report.Date) ,
',',
report.ProductPrice --(not working) order by DATE(report.ProductPrice) ,
"]"
)
) AS ProductPrice
FROM report
GROUP BY report.Name ;
Run Code Online (Sandbox Code Playgroud)
您应该在 中使用它group_concat,而不是concat:
group_concat(
concat('[', date(report.Date), ',', report.ProductPrice, ']')
order by date(report.Date) desc
)
Run Code Online (Sandbox Code Playgroud)