DROP VIEW LD0V5A
;
CREATE VIEW LD0V5A AS
	SELECT * FROM LD0P0A KART
		WHERE (EXISTS (SELECT 'X' FROM LD0V1U90 U90 WHERE U90.PNR=KART.PNR)
		OR EXISTS (SELECT 'X' FROM LD0V0U10 U10 WHERE U10.PERSONNR=KART.PNR))
AND (EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR
								  JOIN LD0V0ANVANDARE AJD
								  ON AJD.CSSANV=SEKR.CSSANV
								  AND SEKR.PNR=KART.PNR)
		OR NOT EXISTS (SELECT 'X' FROM LD0P0SEKR SEKR WHERE SEKR.PNR=KART.PNR))
;
