DROP VIEW LD0VAA0CaseworkerServiceHistory
;

CREATE VIEW LD0VAA0CaseworkerServiceHistory
AS
SELECT C22.INSNR,
       C22.FOMDAT,
       C22.TOMDAT,
       C22.HAND,
       C22.MEDHAND,
       C22.ORGENHNR,
       C22.ORGENHNR2,
       C22.ORGID,
       I.NAMN CASEWORKERNAME,
       I2.NAMN COCASEWORKERNAME,
       J01.NAMN ORGANIZATIONNAME
FROM LD0V0C22 C22 
LEFT OUTER JOIN LD0V0I I 
ON I.HAND = C22.HAND 
LEFT OUTER JOIN LD0V0J01 J01 
ON J01.ORGID = C22.ORGID 
AND J01.ORGENHNR = C22.ORGENHNR 
LEFT OUTER JOIN LD0V0I I2 
ON I2.HAND = C22.MEDHAND 
;
