3,491
社区成员
发帖
与我相关
我的任务
分享
select tableA.手机品牌, tableA.厂商,
tableA.TelphoneNum || (select decode(nvl(count(1),0), 0, '', '|在tableB中出现过') from tableB where tableA.TelphoneNum =tableB.TelphoneNum)
|| (select decode(nvl(count(1),0), 0, '', '|在tableC中出现过') from tableC where tableA.TelphoneNum =tableC.TelphoneNum)
|| .........
|| (select decode(nvl(count(1),0), 0, '', '|在tableN中出现过') from tableN where tableA.TelphoneNum =tableN.TelphoneNum)
from tableA
select tableA.手机品牌, tableA.厂商,
tableA.TelphoneNum || (select decode(nvl(count(1),0), 0, '', '|在tableB中出现过') from tableB where tableA.TelphoneNum =tableB.TelphoneNum)
|| (select decode(nvl(count(1),0), 0, '', '|在tableC中出现过') from tableC where tableA.TelphoneNum =tableC.TelphoneNum)
|| .........
|| (select decode(nvl(count(1),0), 0, '', '|在tableN中出现过') from tableN where tableA.TelphoneNum =tableN.TelphoneNum)
from tableA
create view tableBtoN as
select TelphoneNum,'tableB' tablename from tableB
union all
select TelphoneNum,'tableC' tablename from tableC
union all
...
select TelphoneNum,'tableN' tablename from tableN
select TelphoneNum,(select tablename from tableBtoN t2 where t1.TelphoneNum=t2.TelphoneNum and rownum=1) "是否出现过" from tableA