- 论坛徽章:
- 0
|
如题,代码如下:
Export to 检查结果目录\多配偶婚姻状况.csv of del
select * from (
(select '客户编号','客户名称','配偶名称','配偶证件类型','配偶证件号码','关系','管户机构','管户人'
from dual )
union (select ''''||CustomerID,
getCustomerName(CustomerID),CustomerName
,getItemName('CertType',CertType) as CertTypeName,''''||CertID,getItemName('RelationShip',RelationShip) as RelationName
,getOrgName(InputOrgId) as OrgName
,getUserName(InputUserId) as UserName
from
customer_relative CR1 where CR1.RelationShip='0301' and
exists (select 'x' from customer_relative CR where
CR.RelativeID=CR1.RelativeID and CR.CustomerID<>CR1.CustomerID
and CR.RelationShip='0301') and exists (select 'X' from Customer_belong CB where CB.CustomerID=CR1.CustomerID) order by CR1.RelativeID desc)) t order by 1 desc@ |
|