oraclel wmsys.wm_concat的使用

create table fuqiang as


select objectid,max(contentCode) as contentCode ,max(name_lang1) as name_lang1 ,max(externalid)as externalid,max(areacode) as areacode,max(restype) as restype,max(validShowDate) as validShowDate,max(accessright) as accessright ,max(pri) as pri,max(description_lang1) as description_lang1,
max(ownerid) as ownerid ,max(providername) as providername ,max(isSubscribeMsg)as isSubscribeMsg,max(iscommentenable)as iscommentenable,max(isportalsubenable) as isportalsubenable,max(resourcebound) as resourcebound,max(resChildren||' ')as resChildren,max(extproperty||' ') as extproperty,
wmsys.wm_concat(decode(NVL(resTypeValue,''),'',';',resTypeValue)||';') as resTypeValue,max(ftpurl) as ftpurl,max(ftpaccount) as ftpaccount,max(ftppasswd) as ftppasswd
from
(

select
    max(med.objectid) as objectid,
        max(content.contentcode) as contentCode,
              max(med.name_lang1) as name_lang1 ,
       max((select g.externalid from mdsp_t_categoryinfo g where g.objectid = (select q.source_id from t_cmp_ref_categorytocontent q where q.target_id = content.objectid))) as externalid ,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'areacode' and s.objectid = content.objectid)) as areacode,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'restype' and s.objectid = content.objectid)) as restype,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'validShowDate' and s.objectid = content.objectid)) as validShowDate,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'accessright' and s.objectid = content.objectid)) as accessright,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'pri' and s.objectid = content.objectid)) as pri,
max(med.description_lang1) as description_lang1 ,
max(content.ownerid) as ownerid ,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'providername' and s.objectid = content.objectid)) as providername,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'isSubscribeMsg' and s.objectid = content.objectid)) as isSubscribeMsg,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'iscommentenable' and s.objectid = content.objectid)) as iscommentenable,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'isportalsubenable' and s.objectid = content.objectid)) as isportalsubenable,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'resourcebound' and s.objectid = content.objectid)) as resourcebound,
null as resChildren ,
null as extproperty,
      -- max(resport.source_id) as source_id ,
     --  max(resport.target_id) as target_id ,
     --  max(med.objectid) as objectid,
      -- max(med.description_lang1) as description_lang1,
       wmsys.wm_concat(decode(NVL(ext001.value,''),'','""',ext001.value)) as resTypeValue,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'ftpurl' and s.objectid = content.objectid)) as ftpurl,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'ftpaccount' and s.objectid = content.objectid)) as ftpaccount,
max((select s.value from T_CMP_EXT_MEDIACONTENT s where s.name = 'ftppasswd' and s.objectid = content.objectid)) as ftppasswd
  from T_CMP_TYPE_MEDIACONTENT       med,
       t_cmp_ref_resource_PortalType resport,
       t_cmp_type_portaltypeinfo     portinfo,
       t_cmp_ref_portalTypeInfo_Url  mm,
       t_cmp_ext_resourceurl ext001,
       t_cmp_type_content content
where resport.source_id = med.objectid
   and portinfo.objectid = resport.target_id
   and mm.source_id = resport.target_id
   and mm.target_id = ext001.objectid
   and ext001.name in('displaymode','biglogo','smalllogo','subtitle','needvisitparam')
   and content.objectid = med.objectid
   and med.name_lang1 = 'fuqiang001_app'
   group by resport.target_id
) hello group by objectid;







猜你喜欢

转载自xinyoulinglei.iteye.com/blog/1753863