查询中的MySQL group_concat_max_len [英] MySQL group_concat_max_len in a query
问题描述
我正在寻找一种插入方法
I'm searching a way to insert this
SET GLOBAL group_concat_max_len=15000
在现有的SQL查询中,如下所示:
in an existing SQL query such as the following:
SELECT *
FROM `Pages`
WHERE id =1
UNION SELECT 1 , 2, IF( 1 >0, SET GLOBAL group_concat_max_len=15000,'B' )
但是我无法使它正常工作,因为通常此查询是单独执行的,我想知道你们中的某些人是否有如何使它工作的想法
But I couldn't make it work because usually this query is executed on its own and I was wondering if some of you had any idea how to make it work
推荐答案
您不能像您正在做的那样,甚至在子查询中也不能使用SET
语句.自己在一个语句中执行SET
.您设置的值将影响后续语句.
You can't use a SET
statement inside an expression like you're doing, or even in a subquery. Execute the SET
in one statement by itself. The value you set will affect subsequent statements.
顺便说一句,您是否知道SET GLOBAL
意味着该设置将影响服务器上的所有其他MySQL连接,并且该设置甚至会在当前会话完成后继续存在,直到您将其设置为其他设置为止?如果只希望该值影响当前会话,则可能要使用SET SESSION
.
By the way, are you aware that SET GLOBAL
means the setting will affect all other MySQL connections on your server, and the setting will even persist after your current session is done, until you set it to something else? You might want to use SET SESSION
if you only want the value to affect your current session.
这篇关于查询中的MySQL group_concat_max_len的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!