select ep_general_cou.loanCardNo,ep_general_cou.loanCardNo,general_cou,register_capital_cou,admin_manager_cou,arrear_interest_cou
from
(select loanCardNo,count(*) as general_cou from ep_general where 1=1 group by loanCardNo ) as ep_general_cou
left join
(select loanCardNo,count(*) as register_capital_cou from ep_register_capital group by loanCardNo) as ep_register_capital_cou
on ep_general_cou.loanCardNo=ep_register_capital_cou.loanCardNo
left join
(select loanCardNo,count(*) as admin_manager_cou from ep_admin_manager group by loanCardNo) as ep_admin_manager_cou
on ep_general_cou.loanCardNo=ep_admin_manager_cou.loanCardNo
left join
(select loanCardNo,count(*) as arrear_interest_cou from ep_arrear_interest group by loanCardNo) as ep_arrear_interest_cou
on ep_general_cou.loanCardNo=ep_arrear_interest_cou.loanCardNo
哪位高手能把上面的结果集建立一个view,给出view创建过程,谢谢
------解决方案--------------------------------------------------------
create view 视图名 as
select ep_general_cou.loanCardNo,ep_general_cou.loanCardNo,general_cou,register_capital_cou,admin_manager_cou,arrear_interest_cou
from
(select loanCardNo,count(*) as general_cou from ep_general where 1=1 group by loanCardNo ) as ep_general_cou
left join
(select loanCardNo,count(*) as register_capital_cou from ep_register_capital group by loanCardNo) as ep_register_capital_cou
on ep_general_cou.loanCardNo=ep_register_capital_cou.loanCardNo
left join
(select loanCardNo,count(*) as admin_manager_cou from ep_admin_manager group by loanCardNo) as ep_admin_manager_cou
on ep_general_cou.loanCardNo=ep_admin_manager_cou.loanCardNo
left join
(select loanCardNo,count(*) as arrear_interest_cou from ep_arrear_interest group by loanCardNo) as ep_arrear_interest_cou
on ep_general_cou.loanCardNo=ep_arrear_interest_cou.loanCardNo