gpt4 book ai didi

mysql - Mysql Group_concat 与 concat

转载 作者:行者123 更新时间:2023-11-29 19:42:38 26 4
gpt4 key购买 nike

我正在使用下面的查询来获取数据,但我得到的结果被截断

SELECT group_concat(concat(`cl`.`payment_info`, '<=>', `cl`.`total_amount`) SEPARATOR '<==>') AS payment_info

Array
(
[0] => Array
(
[payment_info] => [{"payment_date":"12\/12\/2016","payment_percentage":"30.00","payment_status"
:"Paid"},{"payment_date":"13\/12\/2016","payment_percentage":"20.00","payment_status":"Unpaid"},{"payment_date"
:"","payment_percentage":"","payment_status":"Unpaid"},{"payment_date":"","payment_percentage":"","payment_status"
:"Unpaid"},{"payment_date":"","payment_percentage":"","payment_status":"Unpaid"}]<=>0.00<==>[{"payment_date"
:"12\/12\/2016","payment_percentage":"50.00","payment_status":"Paid"},{"payment_date":"13\/12\/2016"
,"payment_percentage":"40.00","payment_status":"Unpaid"},{"payment_date":"","payment_percentage":"","payment_status"
:"Unpaid"},{"payment_date":"","payment_percentage":"","payment_status":"Unpaid"},{"payment_date":"","payment_percentage"
:"","payment_status":"Unpaid"}]<=>548.43<==>[{"payment_date":"12\/12\/2016","payment_percentage":"30
.00","payment_status":"Paid"},{"payment_date":"13\/12\/2016","payment_percentage":"20.00","payment_status"
:"Unpaid"},{"payment_date":"","payment_percentage":"","payment_status":"
)

)

当数据很大时,我遇到这个问题,否则这个查询工作正常,请告诉我哪里出错了。

付款信息中保存的是json格式数据,金额中保存的是金额。 payment_info 数据类型为文本

最佳答案

您必须设置group_concat_max_len。默认长度为 1024 个字符。请参阅手册信息

group_concat_max_len

Description: Maximum length in bytes of the returned result for a GROUP_CONCAT() function.
Commandline: --group-concat-max-len=#
Scope: Global, Session
Dynamic: Yes
Data Type: numeric
Default Value: 1024
Range - 32-bit: 4 to 4294967295
Range - 64-bit: 4 to 18446744073709547520

关于mysql - Mysql Group_concat 与 concat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41257685/

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