2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionPallet_List`(vTruckFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT ep.id Pallet,
|
|
|
|
count(DISTINCT t.routeFk) Rutas,
|
|
|
|
count(DISTINCT e.id) Eti
|
|
|
|
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.truckFk = vTruckFk
|
|
|
|
GROUP BY ep.id;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|