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

23 lines
587 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`.`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'