salix/db/routines/vn/procedures/worker_getFromHasMistake.sql

20 lines
492 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`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 ;