DELIMITER $$ CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionScan_List`(vPalletFk INT) BEGIN SELECT es.id, t.routeFk Ruta, t.id Ticket, e.counter Caja, es.expeditionFk FROM vn.expeditionScan es JOIN vn.expedition e ON e.id = es.expeditionFk JOIN vn.ticket t ON t.id = e.ticketFk WHERE es.palletFk = vPalletFk ORDER BY Ruta, Ticket, Caja; END$$ DELIMITER ;