Issue with SQL Select Command Using Multiple Tables

You are missing some join conditions. The explicit join syntax makes it harder to miss:

select ma.muncipilitycode, rd.specialnumber, osl.documenttype, osl.workpermitserial, osl.workpermityear, ma.applicationnumber
from   vls$licenseapplication la
       join gam$mainapplication ma
            on  ma.??? = la.???  -- Here
       join gam$regdoc rd
            on  rd.??? = ???     -- and here
       join gam$regdoc_mainapplication rdma
            on  rdma.gam$regdocid = rd.id
       join gam$occstruct_app osma
            on  osma.gam$mainapplicationid = rdma.gam$mainapplicationid 
       join gam$occstructlic osl
            on  osl.id = osma.gam$occstructlicid 
where  rd.specialnumber is not null
and    ma.applicationnumber is not null
and    osl.documenttype is not null
and    osl.workpermitserial is not null
and    osl.workpermityear is not null

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top