-
-
ysy123 初学数据Lv2
发表于2021-7-14 16:38
悬赏20
已解决
楼主
本帖最后由 ysy123 于 2021-7-14 16:49 编辑
9个回答
shaoshl 发表于 2021-7-14 17:07
请提供一下详细报错信息.或者sql
select d.banktype_name, sum(d.balance)
from (select banktype_name, (balance / '10000') balance
from (select '' banktype_name, '' balance
from fi_ds_exchange_bill_tab_520000 t
where t.rg_code = '520000'
and t.is_cz = 0
and t.hold5 = 0
and t.report_date = '2021-06-30'
group by owner_code, owner_name, report_date
union all
select banktype_name, balance
from (select a.owner_code,
(case
when a.bank_name like '%中信银行%' then
'中信银行'
when a.bank_name like '%中国银行%' then
'中国银行'
when a.bank_name like '%交通银行%' then
'中国交通银行'
when a.bank_name like '%贵州银行%' then
'贵州银行'
when a.bank_name like '%建%行%' then
'中国建设银行'
when a.bank_name like '%农业银行%' then
'中国农业银行'
when a.bank_name like '%工商银行%' then
'中国工商银行'
when a.bank_name like '%招商银行%' then
'招商银行'
when a.bank_name like '%贵阳银行%' then
'贵阳银行'
when a.bank_name like '%兴业银行%' then
'兴业银行'
when a.bank_name like '%邮政储蓄银行%' then
'中国邮政储蓄银行'
when a.bank_name like '%国家开发银行%' then
'国家开发银行'
when a.bank_name like '%浙商银行%' then
'浙商银行'
when a.bank_name like '%浦东发展银行%' then
'浦发银行'
when a.bank_name like '%中国农业发展银行%' then
'中国农业发展银行'
when a.bank_name like '%重庆银行%' then
'重庆银行'
else
a.bank_name
end) banktype_name,
'0' balance
from v_acc_accountapply a
where not exists (select 1
from fi_ds_exchange_bill_tab_520000 f
where f.account_no = a.account_no
and f.report_date = '2021-06-30'
and f.rg_code = a.rg_code)
and a.rg_code = '520000'
and a.IS_CZ = 0
and a.HOLD5 = 0)
union all
select a.banktype_name, balance
from (select t.banktype_name, to_char(t.balance) balance
from fi_ds_exchange_bill_tab_520000 t
where t.rg_code = '520000'
and t.is_cz = 0
and t.hold5 = 0
and t.report_date = '2021-06-30') a
left join (select t.banktype_name
from fi_ds_exchange_bill_tab_520000 t
where t.rg_code = '520000'
and t.is_cz = 0
and t.hold5 = 0
and t.report_date = '2021-06-30'
group by banktype_name, report_date) b
on a.banktype_name = b.banktype_name)) d
group by banktype_name;
shaoshl 发表于 2021-7-14 17:33
在BI中测试,是在哪里测试得?
sql数据源,然后报错测试不通过
shaoshl 发表于 2021-7-14 17:37
测试不通过没有任何提示吗?
没有,就只返回了一个测试不通过,没有错误原因
我建议你排查一下,先单独执行每一个sql.然后在分别执行两表之间得union all.问题很可能出在union all上
shaoshl 发表于 2021-7-14 17:47
我建议你排查一下,先单独执行每一个sql.然后在分别执行两表之间得union all.问题很可能出在union all上 ...
单独执行每一条都可以执行,加上union all就不行,BI里面使用union all有什么需要注意的吗?