Use of CASE statement in a MySQL query
If you need to check if there is any project that has task, use something like    

SELECT a.id_task,  
Case WHEN b.id_task IS NULL then 0 else 1 end as HasProject 
from TASK a
LEFT join (SELECT DISTINCT id_task FROM PROJECT_HAS_TASK)b on (a.id_task = b.id_task)
;
-- if you need number of tasks for a project
Select  a.id_task,
COUNT(b.id_project) as num_projects
from TASK a
LEFT join PROJECT_HAS_TASK b on a.id_task = b.id_task
GROUP BY a.id_task;