CREATE OR REPLACE DEFINER=`vn`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`itemEntryIn` AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`, `t`.`landed` AS `landed`, `b`.`itemFk` AS `itemFk`, `b`.`quantity` AS `quantity`, `t`.`isReceived` AS `isReceived`, `t`.`daysInForward` AS `isVirtualStock`, `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 `b`.`quantity` <> 0