DROP VIEW LD0V0E55
;
CREATE VIEW LD0V0E55
      AS SELECT * FROM LD0P0E55 E55
		WHERE (EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR
								  JOIN LD0V0ANVANDARE AJD
								  ON AJD.CSSANV=SEKR.CSSANV
								  AND SEKR.PNR=E55.MODERPNR
								  )
		OR NOT EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR WHERE SEKR.PNR=E55.MODERPNR
								  ))
		AND (EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR
								  JOIN LD0V0ANVANDARE AJD
								  ON AJD.CSSANV=SEKR.CSSANV
								  AND SEKR.PNR=E55.FADFOREPNR
								  )
		OR NOT EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR WHERE SEKR.PNR=E55.FADFOREPNR
								  ))
		AND (EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR
								  JOIN LD0V0ANVANDARE AJD
								  ON AJD.CSSANV=SEKR.CSSANV
								  AND SEKR.PNR=E55.BARNPNR
								  )
		OR NOT EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR WHERE SEKR.PNR=E55.BARNPNR
								  ))
;