2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`sale_freightComponent`
|
|
|
|
AS SELECT `t`.`id` AS `ticketFk`,
|
|
|
|
`sc`.`value` * `s`.`quantity` AS `amount`,
|
|
|
|
`t`.`shipped` AS `shipped`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`vn`.`ticket` `t` STRAIGHT_JOIN `vn`.`sale` `s` ON(`t`.`id` = `s`.`ticketFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`saleComponent` `sc` ON(`sc`.`saleFk` = `s`.`id`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`component` `c` ON(`c`.`id` = `sc`.`componentFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`componentType` `ct` ON(
|
|
|
|
`ct`.`id` = `c`.`typeFk`
|
2024-07-01 09:11:16 +00:00
|
|
|
AND `ct`.`code` = 'freight'
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
)
|