数据库报错 1172 - Result consisted of more than one row
报错原因
存储过程中存在
DECLARE
isUserCode VARCHAR (30);
SELECT employeeno INTO isUserCode FROM staff_synchronization GROUP BY employeeno HAVING COUNT(*) > 1;查出多条记录插入到一个字段中去了
问题解决
SELECT employeeno INTO isUserCode FROM staff_synchronization GROUP BY employeeno HAVING COUNT(*) > 1 LIMIT 1;
在有可能出现多个结果的地方都加上了LIMIT 1;这样就能够保证有唯一确定的一行的数据中的某列可以赋值给对应的变量。