DROP VIEW LD0VAA0RHACCOMODATIONSINFO
;
CREATE VIEW LD0VAA0RHACCOMODATIONSINFO
AS
SELECT RH.ACCOMODATIONID,
RH.ADDRESS,
RH.ZIPCODE,
RH.CITY,
RH.APARTMENTNUMBER,
RH.HASBALCONY,
RH.HASELEVATOR,
RH.HASSTORAGE,
RH.HASLAND,
RH.APARTMENTSIZE,
RH.FLOOR,
RH.SIZEINSQUAREMETERS,
RH.AVAILABLEFROMDATE,
RH.AVAILABLETODATE,
RH.RENTINCLUSIVEEL,
RH.RENTEXCLUSIVEEL,
RH.STATUS,
RH.LANDLORDID,
RH.CREATEDDATE,
RH.UPDATEDDATE,
RH.UPDATEDSIGNATURE, 
T1.KLARTEXT APARTMENTSIZE_T,
L1.NAME LANDLORDNAME_T,
T2.KLARTEXT STATUS_T,
P.NAMN APPLICANTNAME_T,
C.NAMN COAPPLICANTNAME_T
FROM LD0VAA0RHACCOMODATION RH 
LEFT JOIN LD0V0Q01 T1 
ON T1.KODTYP ='RHACCTYP' 
AND T1.KOD = RH.APARTMENTSIZE
LEFT JOIN LD0VAA0RHLANDLORD L1 
ON L1.LANDLORDID = RH.LANDLORDID
LEFT JOIN LD0V0Q01 T2 
ON T2.KODTYP ='RHACCSTAT' 
AND T2.KOD = RH.STATUS
LEFT JOIN LD0VAA0RHOFFER T3 
ON RH.ACCOMODATIONID = T3.ACCOMODATIONID 
AND T3.ACCEPTANCE != 2
LEFT JOIN LD0VAA0RHAPPLICATION T4 
ON T3.APPLICATIONID = T4.APPLICATIONID
LEFT JOIN LD0V0A P 
ON T4.APPLICANTID = P.PNR
LEFT JOIN LD0V0A C 
ON T4.COAPPLICANTID = C.PNR
;