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

28 lines
740 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`.`mistake`
AS SELECT `wr`.`code` AS `revisador`,
`s`.`concept` AS `concept`,
`w`.`code` AS `sacador`,
`w`.`firstName` AS `firstName`,
`w`.`lastName` AS `lastName`,
`mt`.`description` AS `description`,
cast(`iss`.`created` AS date) AS `created`,
`w`.`id` AS `workerFk`
FROM (
(
(
(
(
`vn`.`saleMistake` `sm`
JOIN `vn`.`mistakeType` `mt` ON(`mt`.`id` = `sm`.`typeFk`)
)
JOIN `vn`.`worker` `wr` ON(`wr`.`id` = `sm`.`userFk`)
)
JOIN `vn`.`sale` `s` ON(`s`.`id` = `sm`.`saleFk`)
)
JOIN `vn`.`itemShelvingSale` `iss` ON(`iss`.`saleFk` = `sm`.`saleFk`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `iss`.`userFk`)
)