Reputation: 8068
I have a view in MySql (5.7.30) that is composed using a GROUP_CONCAT
statement. The field is rather long as it aggregates several rows of data.
The problem I'm facing is that the row only returns around 1000 characters of the transaction_details_html
field and truncates off the rest.
Is it possible for me to return the entire string? Or is this a hard limitation?
The view looks like this:
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`10.132.93.224`
SQL SECURITY INVOKER
VIEW `paid_transactions_email_zapier` AS
SELECT
`t`.`id` AS `id`,
`t`.`user_id` AS `user_id`,
`t`.`date` AS `date`,
`t`.`payment_provider_code` AS `payment_provider_code`,
`t`.`payment_tx_id` AS `payment_tx_id`,
`t`.`status` AS `status`,
GROUP_CONCAT(CONCAT('<tr style="height: 30px;">',
'<td align="left"><a href="https://myapp.com/',
`d`.`id`,
'">',
`c`.`title`,
'</a></td>',
'<td align="left" style="padding-left: 10px;">',
`td`.`product_id`,
'</td>',
'<td align="left" style="padding-left: 10px;">',
`d`.`language_name`,
'</td>',
'<td align="right" style="padding-left: 10px;">$',
`td`.`price`,
'</td>',
'</tr>')
SEPARATOR ' ') AS `transaction_details_html`,
SUM(`td`.`price`) AS `total_price`,
`u`.`email` AS `email`,
`up`.`fname` AS `fname`,
`up`.`lname` AS `lname`
FROM
(((((`transaction` `t`
JOIN `transaction_detail` `td`)
JOIN `user` `u`)
JOIN `user_profile` `up`)
JOIN `distribution` `d`)
JOIN `content` `c`)
WHERE
((`td`.`transaction_id` = `t`.`id`)
AND (`u`.`id` = `t`.`user_id`)
AND (`up`.`user_id` = `u`.`id`)
AND (`d`.`id` = `td`.`distribution_id`)
AND (`c`.`id` = `d`.`content_id`))
GROUP BY `t`.`id`
ORDER BY `t`.`date` DESC
LIMIT 100
Upvotes: 0
Views: 37
Reputation: 49395
The global variable group_concat_max_len
determines how big GROUP_CONCAT can be. usually it is 1024 characters, so your number is strange
You can increase, so that your query runs without hickups.
Like
SET GLOBAL group_concat_max_len = 10000;
Upvotes: 1