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

32 lines
818 B
MySQL
Raw Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`floraHollandBuyedItems`
AS SELECT `b`.`itemFk` AS `itemFk`,
`i`.`longName` AS `longName`,
`b`.`quantity` AS `quantity`,
`b`.`buyingValue` AS `buyingValue`,
`tr`.`landed` AS `landed`,
`e`.`companyFk` AS `companyFk`
FROM (
(
(
(
(
`vn`.`buy` `b`
JOIN `vn`.`item` `i` ON(`b`.`itemFk` = `i`.`id`)
)
JOIN `vn`.`itemType` `it` ON(`it`.`id` = `i`.`typeFk`)
)
JOIN `vn`.`itemCategory` `ic` ON(`ic`.`id` = `it`.`categoryFk`)
)
JOIN `vn`.`entry` `e` ON(`e`.`id` = `b`.`entryFk`)
)
JOIN `vn`.`travel` `tr` ON(
`tr`.`id` = `e`.`travelFk`
AND `ic`.`id` NOT IN (8, 6)
AND `b`.`buyingValue` <> 0
AND `b`.`quantity` <> 0
AND `e`.`supplierFk` IN (1664, 1665, 1666, 1465, 1433)
)
)