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

20 lines
530 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`traceabilitySale`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
`sb`.`buyFk` AS `buyFk`,
`t`.`shipped` AS `shipped`,
`t`.`nickname` AS `nickname`,
`s`.`quantity` AS `quantity`,
concat(`w`.`firstName`, ' ', `w`.`lastName`) AS `worker`
FROM (
(
(
`vn`.`saleBuy` `sb`
JOIN `vn`.`sale` `s` ON(`s`.`id` = `sb`.`saleFk`)
)
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `s`.`ticketFk`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `sb`.`workerFk`)
)