SELECT `a`.*, `b`.`level` as `academic_level`, `c`.`id` as `attachment_id`, `c`.`attachment_name`, `c`.`location`, `c`.`file_type`, `c`.`file_ext`, `c`.`mask_id`, `d`.`action_efective_date`, `e`.`type` as `action_type`
FROM `user__academic_qualification` `a`
JOIN `_ref__academic` `b` ON `b`.`id` = `a`.`level_id`
LEFT OUTER JOIN `user__academic_qualification_attachment` `c` ON `c`.`academic_qualification_id` = `a`.`id` and `c`.`is_delete` = 0
LEFT JOIN `user__profiling` `d` ON `d`.`id` = `a`.`profiling_id`
LEFT JOIN `_ref__action_type` `e` ON `e`.`id` = `d`.`action_type_id`
WHERE `a`.`user_id` = '103'
AND `a`.`is_delete` =0
AND a.profiling_id IN (SELECT MAX(a.profiling_id)
FROM `user__academic_qualification` `a`
WHERE `a`.`user_id` = '103'
AND `a`.`is_delete` =0)