gpt4 book ai didi

mysql - 为什么我不能在返回多个字段的请求中关联一个变量?

转载 作者:行者123 更新时间:2023-11-30 22:05:03 24 4
gpt4 key购买 nike

下面的程序返回

Error Code: 1222: The used SELECT statements have a different number of columns

CREATE PROCEDURE `dev_getDashBoard`(cognito VARCHAR(100))
BEGIN
DECLARE id_user,team_last INT;

SELECT ct.hasInvoice,ct.currentCredits,ct.hasPremium,u.lastTeam INTO team_last FROM configTeam ct
INNER JOIN users u ON u.lastTeam = ct.team_id
WHERE u.identityId = cognito COLLATE utf8_unicode_ci LIMIT 1

CALL otherProcedure(team_last);
END

sql 总是返回一行。为什么mysql返回错误?

最佳答案

SELECT 中删除其他列:

SELECT u.lastTeam INTO team_last
FROM configTeam ct INNER JOIN
users u
ON u.lastTeam = ct.team_id
WHERE u.identityId = cognito COLLATE utf8_unicode_ci
LIMIT 1

关于mysql - 为什么我不能在返回多个字段的请求中关联一个变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42089703/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com