CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` 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` AND `ct`.`code` = 'freight' ) )