首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Informix >

informix的view创建有关问题

2012-03-21 
informix的view创建问题selectep_general_cou.loanCardNo,ep_general_cou.loanCardNo,general_cou,registe

informix的view创建问题
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

热点排行