
DROP VIEW LD0VAA0SearchSurveyEducationalLevel
;

CREATE VIEW LD0VAA0SearchSurveyEducationalLevel AS SELECT
    U28.*, 
    A.NAMN AS PERSONNAME,
    A.KUNDNUMMER,
    U01.PERSONNR,
    A.FODDAT,
    A.KON,
     A.ORT,
     A.ADRESS,
     A.POSTNR,
     A.COADR AS PERSONCOADDRESS,
    Q.KLARTEXT AS UTBILDNINGSNIVA_T 
FROM LD0P0U28 U28
LEFT JOIN LD0V0U01 U01 ON U28.KARTLAGGNR = U01.KARTLAGGNR
LEFT JOIN LD0V0A A ON A.PNR = U01.PERSONNR 
LEFT OUTER JOIN LD0P0Q01 Q ON Q.KODTYP = 'LNUTBNIVA' AND Q.KOD = U28.UTBILDNINGSNIVA
;

