我正在尝试编写一个需要 PostgreSQL 中的存储过程的 select 语句。但是,它因此错误而失败:
ERROR: subquery must return only one column.
查询如下:
select(
(select
'q1_parasiticide_carton_rebate' as rewardName,
case when q1_parasiticide_carton_rebate is null then CAST(0 as VARCHAR)
else cast(coalesce(q1_parasiticide_carton_rebate,0) as VARCHAR(10)) end as rewardAmount
from temptable
),
(select
'q2_parasiticide_carton_rebate' as rewardName,
case when q2_parasiticide_carton_rebate is null then CAST(0 as VARCHAR)
else cast(coalesce(q2_parasiticide_carton_rebate,0) as VARCHAR(10)) end as rewardAmount
from temptable
))
from temptable;
请帮我解决一下这个。