select b.leibiebianhao leibiebianhao,danwei
from (
select '1' type,anjianbianhao,shoulingdanwei danwei,'1' leixing,xuyaofankui from view_an_qing_xin_xi_father
where BAOJINGSHIJIAN between (to_date('2005-05-26 00:00:00','yyyy-mm-dd hh24:mi:ss') , to_date('2005-05-26 23:59:59','yyyy-mm-dd hh24:mi:ss')) and shoulingdanwei is not null
union
select '2' type,anjianbianhao,fankuidanwei danwei,'2' leixing,null xuyaofankui from view_an_qing_xin_xi_father
where between (to_date('2005-05-26 00:00:00','yyyy-mm-dd hh24:mi:ss') , to_date('2005-05-26 23:59:59','yyyy-mm-dd hh24:mi:ss')) and fankuidanwei is not null
) a,dan_wei_ming_cheng b
where a.danwei = b.bianhao
from (
select '1' type,anjianbianhao,shoulingdanwei danwei,'1' leixing,xuyaofankui from view_an_qing_xin_xi_father
where BAOJINGSHIJIAN between (to_date('2005-05-26 00:00:00','yyyy-mm-dd hh24:mi:ss') , to_date('2005-05-26 23:59:59','yyyy-mm-dd hh24:mi:ss')) and shoulingdanwei is not null
union
select '2' type,anjianbianhao,fankuidanwei danwei,'2' leixing,null xuyaofankui from view_an_qing_xin_xi_father
where between (to_date('2005-05-26 00:00:00','yyyy-mm-dd hh24:mi:ss') , to_date('2005-05-26 23:59:59','yyyy-mm-dd hh24:mi:ss')) and fankuidanwei is not null
) a,dan_wei_ming_cheng b
where a.danwei = b.bianhao
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货