永发信息网

mysql error1241:Operand should contain 1 column(s)

答案:2  悬赏:50  手机版
解决时间 2021-03-03 05:24
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `findHosts`(IN cluster_id VARCHAr(22), IN resource_id VARCHAr(22), IN linuxuser_id VARCHAr(22), IN service_type VARCHAr(10))
SQL SECURITY INVOKER
BEGIN
SET @cluster_id = cluster_id;
SET @resource_id = resource_id;
SET @linuxuser_id = linuxuser_id;
SET @service_type = service_type;
SET @all_ids = CONCAt('(SELECt hc.host_id id FROM host_component hc INNER JOIN service_', @service_type, ' s ON
hc.', @service_type, '_id = s.id) ');
SET @head = 'SELECt DISTINCT ms.id, ms.host_name, ms.ip_address, ms.region,
ms.machine_room, ms.rack, ms.cpu, ms.memory, ms.disk_usage,
ms.status, ms.mem_used, ms.disk_used, ms.cpu_used
FROM manager_host ms INNER JOIN host_component hc
ON ms.id = hc.host_id AND hc.cluster_id = ? ';
SET @service_condition = CONCAt('AND hc.host_id NOT IN ', @all_ids);
SET @tail = 'ORDER BY ms.host_name';
SET @resource_condition = 'AND hc.resource_id = ? ';
SET @linuxuser_condition = 'AND hc.linux_user_id = ? ';
SET @host_sql = CONCAt(@head, @service_condition);

IF (@resource_id IS NOT NULL, @resource_id <> '')
THEN SET @host_sql = CONCAt(@host_sql, @resource_condition);
END IF;

IF (@linuxuser_id IS NOT NULL, @linuxuser_id <> '')
THEN SET @host_sql = CONCAt(@host_sql, @linuxuser_condition);
END IF;

SET @host_sql = CONCAt(@host_sql, @tail);

PREPARE result FROM @host_sql;
EXECUTE result USING @cluster_id, @resource_id, @linuxuser_id;
DEALLOCATE PREPARE result;
END$$

DELIMITER ;

call CALL findHosts('DH90GH9_FHF4GHD3DNP4CG', '', '', 'storm');

Error Code: 1241
Operand should contain 1 column(s)
最佳答案
mysql error1241:Operand shou--根据报错来看 ,你下面的一个查询返回了两个值 cou_name as 最优秀课程,sco_score as 成绩
--Operand should contain 1 column(s)
(select cou_name as 最优秀课程,sco_score as 成绩 from cou,sco where cou.cou_id=sco.cou_id group by stu_id having sco_score=max(sco_score)),
(select cou_name as 最差课程,sco_score as 成绩 from cou,sco where cou.cou_id=sco.cou_id group by stu_id having sco_score=min(sco_score)),ld contain 1 column(s)
全部回答
--根据报错来看 ,你下面的一个查询返回了两个值 cou_name as 最优秀课程,sco_score as 成绩 --operand should contain 1 column(s) (select cou_name as 最优秀课程,sco_score as 成绩 from cou,sco where cou.cou_id=sco.cou_id group by stu_id having sco_score=max(sco_score)), (select cou_name as 最差课程,sco_score as 成绩 from cou,sco where cou.cou_id=sco.cou_id group by stu_id having sco_score=min(sco_score)),
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
我是一名普通二本学校大三学生,想去日本留学
延吉市铁南供热,入冬以来供热效果很差,一个
摸了碧欧泉水动力爽肤水脸火辣辣的
【议会制度】十七世纪晚期英国议会制度确立的
为啥一个工作已婚女同事总是和我套近乎,每次
一个人和她的远房表哥可以结婚吗?
三原和富平哪个好
南师大二附中初中部要多少分
婴儿可以吃酱油吗
做梦梦到自己被锁在箱子里被捆着手,出不来
广西贵港哪有动漫周边店
齐木楠楠的灾难更新完了吗,有多少集?
为什么我的iphone 接收短信总会在几分钟后才
由于读者对图书的需求是多方面的,图书市场往
那种蔬菜含维生素D高
推荐资讯
中国海洋大学金融学同等学力申硕
如何裁剪出圆形图片
上海华联超市北邙店在哪里啊,我有事要去这个
c1(实习期)增驾b2可以吗?需要具备哪些条件
逸美尚洗衣怎么去啊,有知道地址的么
兰寿金鱼腮部出血,是发头筋造成的吗,
QQ登陆器里的密码怎么复制?
尿毒症患者可以有A.血磷升高B.血钙降低C.脑动
斗转星移是指什么
诊断异位ACTH分泌综合征应检查A.血清ACTH和皮
对下图漫画的理解,你认为正确的是A. 孝敬父
洛杉矶是哪个国家的
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?