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

25 lines
694 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`vn-admin`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`mistakeRatio`
AS SELECT `wr`.`code` AS `revisador`,
`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`,
`sm`.`saleFk` AS `saleFk`
FROM (
(
(
(
`vn`.`itemShelvingSale` `iss`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `iss`.`userFk`)
)
LEFT JOIN `vn`.`saleMistake` `sm` ON(`iss`.`saleFk` = `sm`.`saleFk`)
)
LEFT JOIN `vn`.`mistakeType` `mt` ON(`mt`.`id` = `sm`.`typeFk`)
)
LEFT JOIN `vn`.`worker` `wr` ON(`wr`.`id` = `sm`.`userFk`)
)