小明有苹果吃苹果,没苹果吃桔子
数据1:
小明,15012345678,苹果
数据2:
小明,15012345678,桔子
SQL:
select
小明,
15012345678,
case when t1.吃水果=空 then t2.吃水果 else t1.吃水果 end 吃水果
from
(
(select 小明,15012345678,苹果 吃水果) t1
left join
(select 小明,15012345678,桔子 吃水果)
t2
on
t1.小明=t2.小明 and t1.15012345678=t2.15012345678
)