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

15 lines
443 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`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 ;