SELECT `a`.*, `b`.`username`, `c`.`file_name`, `c`.`file_location`, `d`.`id` as `employment_id`, `d`.`position_id`, `e`.`position` as `position_name`, `i`.`position` as `position_category`, `d`.`company_id`, `f`.`name` as `company_name`, `g`.`branch_id`, `h`.`name` as `branch_name`, `d`.`department_id`, `g`.`name` as `department_name`, `j`.`gender`, `k`.`country`, `l`.`state`, `m`.`expired_date` as `passport_expired_date`, `m`.`working_expired_date` as `passport_working_expired_date`, `m`.`issue`, `n`.`country` as `issue_country`, `o`.`country` as `citizen`, `p`.`race` as `race`, `q`.`name` as `religion`
FROM `user` `a`
JOIN `user__login` `b` ON `b`.`user_id` = `a`.`id`
LEFT JOIN `user__picture` `c` ON `a`.`profile_picture_id` = `c`.`id`
LEFT JOIN `user__employment_detail` `d` ON `d`.`user_id` = `a`.`id`
LEFT JOIN `company__position` `e` ON `d`.`position_id` = `e`.`id`
LEFT JOIN `company` `f` ON `d`.`company_id` = `f`.`id`
LEFT JOIN `company__department` `g` ON `d`.`department_id` = `g`.`id`
LEFT JOIN `company__branch` `h` ON `g`.`branch_id` = `h`.`id`
LEFT JOIN `company__position` `i` ON `e`.`parent_id` = `i`.`id`
LEFT JOIN `_ref__gender` `j` ON `j`.`id` = `a`.`gender_id`
LEFT JOIN `_ref__country` `k` ON `k`.`id` = `a`.`country_id`
LEFT JOIN `_ref__state` `l` ON `l`.`id` = `a`.`state_id`
LEFT JOIN `user__passport` `m` ON `m`.`staff_id` = `a`.`id`
LEFT JOIN `_ref__country` `n` ON `m`.`issue` = `n`.`id`
LEFT JOIN `_ref__country` `o` ON `o`.`id` = `a`.`citizen_id`
LEFT JOIN `_ref__race` `p` ON `p`.`id` = `a`.`race_id`
LEFT JOIN `_ref__religion` `q` ON `q`.`id` = `a`.`religion_id`
WHERE `a`.`status` =0
AND `a`.`is_delete` =0
AND `a`.`id` = '3'
ORDER BY `a`.`name` ASC