SELECT `a`.`id` as `code`, `a`.`title`, `a`.`description`, `a`.`document_date`, `d`.`code` as `room_code`, `c`.`code` as `rack_code`, `b`.`box_no`
FROM `kbs__document` `a`
JOIN `kbs__box` `b` ON `b`.`id` = `a`.`box_id`
JOIN `kbs__rack` `c` ON `c`.`id` = `b`.`rack_id`
JOIN `kbs__room` `d` ON `d`.`id` = `c`.`room_id`
JOIN `customer` `e` ON `e`.`id` = `a`.`company_id`
WHERE `a`.`is_delete` =0