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

17 lines
471 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionPallet_View`(vPalletFk INT)
BEGIN
SELECT ep.id Pallet,
t.routeFk Rutas,
count(*) Cajas
FROM vn.expeditionPallet ep
LEFT JOIN vn.expeditionScan es ON es.palletFk = ep.id
LEFT JOIN vn.expedition e ON e.id = es.expeditionFk
LEFT JOIN vn.ticket t ON t.id = e.ticketFk
WHERE ep.id = vPalletFk
GROUP BY t.routeFk;
END$$
DELIMITER ;