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

20 lines
526 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemEntryOut`
AS SELECT `t`.`warehouseOutFk` AS `warehouseOutFk`,
`t`.`shipped` AS `shipped`,
`b`.`itemFk` AS `itemFk`,
- `b`.`quantity` AS `quantity`,
`t`.`isDelivered` AS `isDelivered`,
`e`.`id` AS `entryFk`
FROM (
(
`vn`.`buy` `b`
JOIN `vn`.`entry` `e` ON(`b`.`entryFk` = `e`.`id`)
)
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
)
WHERE `e`.`isExcludedFromAvailable` = 0
AND `e`.`isRaid` = 0
AND `b`.`quantity` <> 0