[英]ERROR 1241 (21000): Operand should contain 1 column(s) in multiple selects
select
(select sum(sal)as sal_tp, sum(local_conv) as lc_tp from budget_tp),
(select sum(sal) from budget_fos_veri) as sal_veri,
(select sum(sal) from budget_fos_picks)as sal_pick,
(select sum(sal) from budget_bpo_other)as sal_bpo;
I get 我懂了
ERROR 1241 (21000): Operand should contain 1 column(s).
Is there any way for my requirement to complete? 有什么办法可以满足我的要求吗? The query is actually a sample.
该查询实际上是一个示例。 I have many tables with multiple columns, I would like to view the sum of individual columns of all the tables, I just tried to view two at a time in first line I get this error, if I try to retrieve only one column then its fine.
我有许多具有多列的表,我想查看所有表的各个列的总和,我只是尝试在第一行中一次查看两个,所以出现此错误,如果我尝试仅检索一个列,则返回精细。
Each subquery should return one field. 每个子查询应返回一个字段。 Try thy query -
尝试查询-
select
(select sum(sal) from budget_tp) as sal_tp,
(select sum(local_conv) from budget_tp) as lc_tp,
(select sum(sal) from budget_fos_veri) as sal_veri,
(select sum(sal) from budget_fos_picks)as sal_pick,
(select sum(sal) from budget_bpo_other)as sal_bpo;
Another one: 另一个:
select
(select concat(sum(sal), ',' ,sum(local_conv)) from budget_tp) as sal_tp_and_lc_tp
(select sum(local_conv) from budget_tp) as lc_tp,
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.