我试过两种方法。首先,只是引用回它自己作为子选择,然后我尝试创建一个临时表,加载所需的数据,然后从临时表中选择子选择。两者都不起作用。
UPDATE t_call_details cd,
(SELECT
sessionid,
GROUP_CONCAT(dir
ORDER BY call_start
SEPARATOR '|') AS gc_dir
FROM
t_call_details
GROUP BY sessionid) AS gc
SET
cd.overall_calldirection = gc.gc_dir
WHERE
cd.sessionid = gc.sessionid
AND ISNULL(cd.overall_calldirection)
接下来我试着。。。
CREATE TEMPORARY TABLE temp_t_call_details LIKE t_call_details;
INSERT INTO temp_t_call_details (id, sessionid, dir) SELECT id, sessionid, dir from t_call_details where isnull(t_call_details.overall_calldirection);
UPDATE t_call_details cd,
(SELECT
sessionid,
GROUP_CONCAT(dir
ORDER BY call_start
SEPARATOR '|') AS gc_dir
FROM
temp_t_call_details
GROUP BY sessionid) AS gc
SET
cd.overall_calldirection = gc.gc_dir
WHERE
cd.sessionid = gc.sessionid
AND cd.year = 2018
AND ISNULL(cd.overall_calldirection);
我刚收到错误代码:2013。在每次超过600秒的查询过程中与mysql服务器失去连接。我认为我的代码是准确的;应该有用。是否有一个超时我错过了,我需要更新到一个更大的数字?
暂无答案!
目前还没有任何答案,快来回答吧!