select c.customid,c.headurl,c.nickname,c.working_years,c.remarks,c.certificate,
t.countTask,w.countWorks
FROM custom_info c
left join (select count(custom_id) as countTask,custom_id from task_info where project_status = 3 GROUP BY custom_id) t on c.customid = t.custom_id
left join (select count(customid) as countWorks,customid from works_info where original_type = 0 and auditing_status = 1 GROUP BY customid) w on c.customid = w.customid
where custom_status = 1
ORDER BY c.customid