18 lines
356 B
SQL
18 lines
356 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`travel_recalc`(vSelf INT)
|
|
proc: BEGIN
|
|
/**
|
|
* Updates the number of entries assigned to the travel.
|
|
*
|
|
* @param vSelf The travel id
|
|
*/
|
|
UPDATE travel
|
|
SET totalEntries = (
|
|
SELECT COUNT(id)
|
|
FROM entry
|
|
WHERE travelFk = vSelf
|
|
)
|
|
WHERE id = vSelf;
|
|
END$$
|
|
DELIMITER ;
|