Jump to content

CONCAT query only returns a few results


dennismonsewicz

Recommended Posts

I have a query that I am writing to convert a query statement into a JSON string, but when it runs it only returns 14 rows and a little bit of the 15th row...

 

Any ideas on why this is?

 

SELECT
     CONCAT("[",
          GROUP_CONCAT(
               CONCAT("{'rowid':'",rowid,"'"),
		 CONCAT(",'carrier':'",carrier,"'"),
               CONCAT(",'manufacturer':'",manufacturer,"'"),
		 CONCAT(",'model':'",model),"'}"
          )
     ,"]") 
AS json FROM portal_deductible

Link to comment
https://forums.phpfreaks.com/topic/199862-concat-query-only-returns-a-few-results/
Share on other sites

I'm going to guess that the length you are getting is ~ 1024 characters -

The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the effective maximum length of the return value is constrained by the value of max_allowed_packet. The syntax to change the value of group_concat_max_len at runtime is as follows, where val is an unsigned integer:

 

SET [GLOBAL | SESSION] group_concat_max_len = val;

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.