赞
踩
oracle 原sql
select
nvl(
(select b.code
from B b
where b.codetype = '123'
and b.code = a.code),
'000000') as code
from
A a
hive 改sql
select
nvl(b.code,'000000') as code
from
A a
left join B b
on b.codetype = '123'
and b.code = a.code
oracle 原sql
select
nvl(
(select b.code
from B b
where b.codetype = '123'
and b.code = a.code),
(select c.code
from C c
where c.codetype = '123'
and c.code = a.code)) as code
from
A a
hive 改sql
select
nvl(b.code,c.code) as code
from
A a
left join B b
on b.codetype = '123'
and b.code = a.code
left join C c
on c.codetype = '123'
and c.code = a.code
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。