DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_getFromHasMistake`(vDepartmentFk INT)
BEGIN

/**
 * Obtiene los trabajadores de los departamentos que se les puede poner error
 * @param vDepartmentFk id del departamento
 *
 */
	
	SELECT w.id,w.firstName, w.lastName,d.name 
		FROM worker w 
			JOIN workerDepartment wd ON wd.workerFk = w.id 
			JOIN department d ON d.id = wd.departmentFk 
		WHERE d.id = vDepartmentFk
		ORDER BY firstName;

END$$
DELIMITER ;
