16 lines
491 B
SQL
16 lines
491 B
SQL
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
SQL SECURITY DEFINER
|
|
VIEW `vn2008`.`v_ticket_amount`
|
|
AS SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`,
|
|
sum(
|
|
`Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100
|
|
) AS `amount`
|
|
FROM (
|
|
`vn2008`.`Movimientos`
|
|
JOIN `vn2008`.`Tickets` ON(
|
|
`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`
|
|
)
|
|
)
|
|
WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH
|
|
GROUP BY `Movimientos`.`Id_Ticket`
|