DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`eti_to_print`(IN idENTRADA INT, IN idPRODUCER INT) BEGIN select Vida as Impresas ,Etiquetas as bultos ,Packing ,Id_Article ,CONCAT(Article,' ',Medida,' ', Categoria) as Articat ,p.name as marca ,Proveedor ,Id_Entrada ,Id_Compra from Compres c join Entradas e using(Id_Entrada) join Proveedores using(Id_Proveedor) join travel tr on tr.id = e.travel_id join Articles a using(Id_Article) left join producer p using(producer_id) where Id_Entrada = idENTRADA and idPRODUCER in (0,a.producer_id) ; END$$ DELIMITER ;