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

20 lines
528 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`.`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`)
)