17 lines
443 B
SQL
17 lines
443 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machine_getWorkerPlate`(vWorkerFk INT)
|
|
BEGIN
|
|
/**
|
|
* Selecciona la matrícula del vehículo del workerfk
|
|
*
|
|
* @param vWorkerFk el id del trabajador
|
|
*/
|
|
SELECT m.plate
|
|
FROM machine m
|
|
JOIN machineWorker mw ON mw.machineFk = m.id
|
|
WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW())
|
|
AND ISNULL(mw.outTimed)
|
|
AND mw.workerFk = vWorkerFk;
|
|
END$$
|
|
DELIMITER ;
|