mysql group concat長度限制

2023-01-25 17:45:44 字數 809 閱讀 6236

group_concat函式有長度限制

查詢當前資料庫長度

show variables like 'group_concat_max_len'

設定當前session的group_concat長度,其他session連線不受影響

set session group_concat_max_len = 10240;

設定全域性group_concat長度

set global group_concat_max_len = 10240

[err] 1227 - access denied; you need (at least one of) the super privilege(s) for this operation

dba可能告訴你,長度太長了,效能差,還可能掛。

還是切開來逐條讀吧。

後續 19.07.31

與dba協商改global變數值,不知道什麼時候被改了回來,dba說:這是測試庫,改了會影響所有使用者,不能改了。好吧想別的辦法。

由於業務**不在手中,需求難提,只能寫session變數修改**交給rd說:看,這樣寫就好了,幫我加一行這個。

而且看起來好像確實不瞭解mysql的變數。)

stmt = conn.createstatement(); // 當前的jdbc連線

stmt.execute("set session group_concat_max_len = 150000");

mysql GROUP CONCAT使用記錄

最近接觸到了動態資料庫操作,之前沒有使用過 group concat函式,現在用來記錄,以免以後忘記,同時分享出來,供參考。其中concat ws中 用來分隔查詢結果,即元素 用來分隔不同的查詢結果,好了不多說,上 private static final string product sku va...

mysql group concat 拼接欄位

今天在公司,接到一個需求,還沒有動手的時候,覺得好難,做不出來的感覺。需求是把兩個欄位的值顯示在一個格子裡。並且以id的形式分組。花了10多分鐘,把效果實現了,才發現原來這麼簡單。一 建立資料庫以及插入資料 create database student 建立資料庫 student create t...

mysql group concat時間用法

第一張表的worksid在第二張表中對應多條資料,需要將每條資料的日期作為結果查詢出來,一個作為 初審時間 另一個作為 複審時間 可以使用group concat 和 group by 來進行分組查詢 然後在服務端進行分割處理 處理複審時間 param list return for map map...