MySQL 报错: Subquery returns more than 1 row

MySQL 报错: Subquery returns more than 1 row
查询 demo

SET @tableNameList := (SELECT id FROM `tableName`);
  1. 查询多条记录
SET @tableNameList := (SELECT GROUP_CONCAT(id) FROM `tableName`);
  1. 查询数量 LIMIT 1 (仅仅避开报错的弱智解决)
SET @tableNameList := (SELECT id FROM `tableName`  LIMIT 1);

Important Warning
GROUP_CONCAT() 最大长度是 1024, 增加长度使用下面语句!!!

SET GLOBAL group_concat_max_len = 1000000;

你可能感兴趣的:(MySQL)