22 lines
549 B
SQL
22 lines
549 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`itemsInSector_get`(vTicketFk INT, vSectorFk INT)
|
|
RETURNS int(11)
|
|
NOT DETERMINISTIC
|
|
READS SQL DATA
|
|
BEGIN
|
|
|
|
DECLARE vItemCount INT;
|
|
|
|
SELECT count(*) INTO vItemCount
|
|
FROM vn.sale s
|
|
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
|
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
WHERE s.ticketFk = vTicketFk
|
|
AND p.sectorFk = vSectorFk;
|
|
|
|
RETURN vItemCount;
|
|
|
|
END$$
|
|
DELIMITER ;
|