DROP VIEW LD0V0CINVESTIGATIONS
;
CREATE VIEW LD0V0CINVESTIGATIONS				 
AS 
SELECT						
C.AEVERKNR,
C.STARTDAT,
C.STOPDAT,
C.AKTPNR,
C.ORGID,
J01.NAMN ORGNAMN,
C.TMARK, 
H.HAND, 
H.NAMN, 
H.TELE1,
C.AEVERKTYP, 
Q.KLARTEXT AEVERKTYP_T, 
Q1.KLARTEXT  AKTI
FROM	
LD0V0C C 
INNER JOIN LD0V0B B 
ON C.AKTNR = B.AKTNR 
INNER JOIN LD0V0Q01 Q 
ON Q.KODTYP = 'UTREDTYP' 
AND Q.KOD = C.AEVERKTYP 
AND Q.XNUM20 = 0	
INNER JOIN LD0V0I H 
ON C.HAND = H.HAND 
INNER JOIN LD0V0Q01 Q1 
ON Q1.KODTYP ='AKTTYP' AND Q1.KOD = B.TYPNR
LEFT JOIN 
 LD0V0J01 J01 ON J01.ORGID=C.ORGID AND J01.ORGENHNR=C.ORGENHNR 
;