
DROP VIEW LD0VAA0SurveyEducationalBackground
;

CREATE VIEW LD0VAA0SurveyEducationalBackground
AS 
SELECT
U20.*,
  Q.KLARTEXT AS LAND_T,
  Q2.KLARTEXT AS RESULTAT_T,
  U99.EXTTEXT AS NIVA_T,
  U99_2.NIVA2_EXTEXT AS INRIKTNING2_T,
  U99_2.NIVA3_EXTEXT AS INRIKTNING3_T,
  U99_2.NIVA4_EXTEXT AS INRIKTNING4_T,
  U99_3.EXTTEXT AS SENIVA_T,
  U99_4.NIVA2_EXTEXT AS SEINRIKTNING2_T,
  U99_4.NIVA3_EXTEXT AS SEINRIKTNING3_T,
  U99_4.NIVA4_EXTEXT AS SEINRIKTNING4_T
FROM LD0V0U20 AS U20
  LEFT OUTER JOIN LD0V0Q01 AS Q ON Q.KODTYP = 'LAND' AND U20.LAND = Q.KOD
  LEFT OUTER JOIN LD0V0Q01 AS Q2 ON Q2.KODTYP = 'LNRESULTAT' AND U20.RESULTAT = Q2.KOD
  LEFT OUTER JOIN LD0V0U99 AS U99 ON U99.EXTKOD = U20.NIVA AND U99.EXTKODTYP = 1
  LEFT OUTER JOIN LD0V1U99 AS U99_2 ON U99_2.NIVA4_EXTKOD = U20.INRIKTNING AND U99_2.NIVA1_EXTKODTYP = 2
  LEFT OUTER JOIN LD0V0U99 AS U99_3 ON U99_3.EXTKOD = U20.SENIVA AND U99_3.EXTKODTYP = 1
  LEFT OUTER JOIN LD0V1U99 AS U99_4 ON U99_4.NIVA4_EXTKOD = U20.SEINRIKTNING AND U99_4.NIVA1_EXTKODTYP = 2
;



