18 lines
352 B
SQL
18 lines
352 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`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 ;
|