Jump to content

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;

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.