salix/db/routines/vn2008/procedures/base_ticket.sql

13 lines
315 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`base_ticket`(IN Id_Ticket INT)
BEGIN
SELECT
red(SUM(Cantidad * Preu * (100 - Descuento) / 100)) AS base
FROm
Movimientos m
INNER JOIN Tickets t USING (Id_Ticket)
WHERE t.Id_Ticket = Id_Ticket;
END$$
DELIMITER ;