Oracle
 sql >> Database >  >> RDS >> Oracle

Come eseguire la divisione e l'unione a sinistra in Oracle

Prova:

SELECT cu.ID , cu.ADI_NUMARASI , co.ID , co.VALUE
FROM 
(
  SELECT id,ADI_NUMARASI,TYPEIDS,DOMAINID,
  regexp_substr(TYPEIDS,'[^,]+', 1, level) typeidsnew 
  FROM Customer 
  GROUP BY id,ADI_NUMARASI,TYPEIDS,DOMAINID,
  regexp_substr(TYPEIDS, '[^,]+', 1, level)
  connect by regexp_substr(TYPEIDS, '[^,]+', 1, level) is not null
) cu 
LEFT JOIN Code co ON cu.typeidsnew = co.ID
AND cu.DomainId = co.domainId 
ORDER BY cu.ID,co.ID

Output:http://sqlfiddle.com/#!4/177e8/1