18 lines
424 B
MySQL
18 lines
424 B
MySQL
|
CREATE OR REPLACE DEFINER=`root`@`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`)
|
||
|
)
|