17 lines
445 B
MySQL
17 lines
445 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`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 ;
|