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

36 lines
734 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
BEGIN
/**
* Devuelve el log de los item en cada carro
*
* @param vShelvingFk Matrícula del carro
*
*/
SELECT isl.itemShelvingFk,
isl.created,
isl.accion,
isl.itemFk,
isl.shelvingFk,
isl.quantity,
isl.visible,
isl.available,
isl.grouping,
isl.packing,
isl.stars,
item.longName,
item.size,
item.subName,
worker.code,
isl.accion
FROM item
JOIN itemShelvingLog isl ON item.id = isl.itemFk
JOIN worker ON isl.workerFk = worker.id
WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk
ORDER BY isl.created DESC;
END$$
DELIMITER ;