dennismonsewicz Posted April 27, 2010 Share Posted April 27, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/199862-concat-query-only-returns-a-few-results/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 27, 2010 Share Posted April 27, 2010 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; Quote Link to comment https://forums.phpfreaks.com/topic/199862-concat-query-only-returns-a-few-results/#findComment-1049052 Share on other sites More sharing options...
dennismonsewicz Posted April 27, 2010 Author Share Posted April 27, 2010 Thanks! I am a newbie when it comes to very complex SQL lol... how would i incorporate that into my query? Quote Link to comment https://forums.phpfreaks.com/topic/199862-concat-query-only-returns-a-few-results/#findComment-1049053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.