set @fromparam= '2018-11-04';
set @toparam= DATE_ADD('2018-12-31', interval 86399 SECOND);
set @customerparam = 773;

set @taskparam = 1;
set @taskfilter=false;
set @taskdefault=false;


        
SELECT 
    PC.cloud_date, PA.person_id, LAM.leave_id
FROM
    person PA
        CROSS JOIN
    cloud_date_table PC  INNER JOIN leave_and_mission LAM ON PA.person_id = LAM.person_id
WHERE
    PA.customer_id = @customerparam
        AND PA.is_deleted = FALSE
        AND PC.cloud_date BETWEEN @fromparam AND @toparam  AND (LAM.start_date <= PC.cloud_date AND LAM.end_date >= PC.cloud_date)