I need to combine two text fields in the MySQL Database table into One, So I have used the Following SQL script to do it.
Table: tbl_newsitems Combine: Need to combine the text in the 'ni_text' with the same 'news_id' Table Layout:
Code used to combine the text:
SELECT
news_id
,
GROUP_CONCAT(ni_text
SEPARATOR ' ')
FROM
tbl_newsitems
GROUP BY news_id
;
But it won't display the full (Complete) text in the result section. The CONCAT field is trimmed and missing some text. The default Data type for the CONCAT field is TEXT (1024)
Result:
So how do I combine the whole text into one field without dropping the content. Please give me the script to do this.
Thanks
To "fix" your group_concat
issue, the server setting group_concat_max_len
will need increased.
MySQL 5.7 Reference Manual / ... / Server System Variables
I believe you should be able to set it just for the session (current connection) without needing to change it globally/permanently on the server. Executing something like SET group_concat_max_len = 1000000;
before your query should solve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With