DROP VIEW LD0VAA0SEARCHASSIGNMENTIFO
;

CREATE VIEW LD0VAA0SEARCHASSIGNMENTIFO
AS SELECT 
N900.*
,A.NAMN as PERSNAMN
,A.KUNDNUMMER as PERSONKEY
,A.ADRESS as ADRESS
,A.COADR as COADR
,A.POSTNR as POSTNR
,A.ORT as ORT
,A.FODDAT as FODDAT
,A.KON as KON
,I1.NAMN as UTFHAND_T
,I2.NAMN as UTFMEDHAND_T
,I3.NAMN as UTFMEDHAND2_T
,J01.NAMN as ORGNAMN_T
,Q01_1.KLARTEXT as STATUS_T
FROM LD0V0N900 N900
LEFT OUTER JOIN LD0V0A A ON A.PNR = N900.PNR
LEFT OUTER JOIN LD0V0I AS I1 ON I1.HAND = N900.UTFHAND
LEFT OUTER JOIN LD0V0I AS I2 ON I2.HAND = N900.UTFMEDHAND
LEFT OUTER JOIN LD0V0I AS I3 ON I3.HAND = N900.UTFMEDHAND2
LEFT OUTER JOIN LD0V0J01 AS J01 ON J01.ORGID = N900.ORGID AND J01.ORGENHNR = N900.ORGENHNR
LEFT OUTER JOIN LD0V0Q01 AS Q01_1 ON Q01_1.KODTYP = 'UIFOSTATUS' AND Q01_1.KOD = N900.STATUS 
;
