DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`freelance_getInfo`(workerFk INT)
BEGIN
	SELECT s.name, s.street, s.city, s.nif, s.postCode
		FROM route r
			JOIN agencyMode am ON r.agencyModeFk = am.id
			JOIN agency a ON am.agencyFk = a.id
			JOIN supplierAgencyTerm sat ON a.id = sat.agencyFk
			JOIN supplier s ON sat.supplierFk = s.id
		WHERE r.workerFk = workerFk
		ORDER BY r.id DESC
		LIMIT 1;
END$$
DELIMITER ;
