24 lines
711 B
MySQL
24 lines
711 B
MySQL
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||
|
SQL SECURITY DEFINER
|
||
|
VIEW `vn2008`.`v_miriam`
|
||
|
AS SELECT `M`.`Id_Article` AS `Id_Article`,
|
||
|
`M`.`Concepte` AS `Concepte`,
|
||
|
`M`.`Cantidad` AS `Cantidad`,
|
||
|
`M`.`Preu` AS `Preu`,
|
||
|
`M`.`Descuento` AS `Descuento`,
|
||
|
`T`.`Fecha` AS `Fecha`,
|
||
|
`T`.`Id_Cliente` AS `Id_Cliente`,
|
||
|
`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`
|
||
|
FROM (
|
||
|
(
|
||
|
(
|
||
|
`vn2008`.`Tickets` `T`
|
||
|
JOIN `vn2008`.`Movimientos` `M` ON(`T`.`Id_Ticket` = `M`.`Id_Ticket`)
|
||
|
)
|
||
|
JOIN `vn2008`.`Articles` `A` ON(`M`.`Id_Article` = `A`.`Id_Article`)
|
||
|
)
|
||
|
JOIN `vn2008`.`Tipos` `TP` ON(`A`.`tipo_id` = `TP`.`tipo_id`)
|
||
|
)
|
||
|
WHERE `T`.`Fecha` >= '2011-01-01'
|
||
|
AND `A`.`tipo_id` = 7
|