salix/db/routines/vn/views/buyerSales.sql

18 lines
422 B
MySQL
Raw Permalink Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`buyerSales`
AS SELECT `v`.`importe` AS `importe`,
`w`.`code` AS `comprador`,
`t`.`year` AS `año`,
`t`.`week` AS `semana`
FROM (
(
(
`bs`.`ventas` `v`
JOIN `vn`.`time` `t` ON(`t`.`dated` = `v`.`fecha`)
)
JOIN `vn`.`itemType` `it` ON(`it`.`id` = `v`.`tipo_id`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `it`.`workerFk`)
)