CREATE OR REPLACE DEFINER=`vn`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`saleCost` AS SELECT `s`.`itemFk` AS `itemFk`, `s`.`ticketFk` AS `ticketFk`, `s`.`concept` AS `concept`, `s`.`quantity` AS `quantity`, `s`.`discount` AS `discount`, `s`.`price` AS `price`, `c`.`name` AS `component`, `sc`.`value` AS `coste` FROM ( ( ( `vn`.`sale` `s` 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`) ) WHERE `ct`.`code` = 'cost'