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

36 lines
935 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`labelInfo`
AS SELECT `i`.`id` AS `itemId`,
`i`.`name` AS `itemName`,
`b`.`stickers` AS `stickers`,
`b`.`printedStickers` AS `life`,
`i`.`inkFk` AS `colorCode`,
`i`.`stems` AS `stems`,
`i`.`category` AS `category`,
`i`.`subName` AS `productor`,
`b`.`packing` AS `packing`,
`clb`.`warehouse_id` AS `warehouse_id`,
`i`.`size` AS `size`,
`b`.`isPickedOff` AS `isPickedOff`,
`e`.`evaNotes` AS `notes`,
`w`.`name` AS `wh_in`,
`e`.`id` AS `entryId`,
`b`.`id` AS `buyId`
FROM (
(
(
(
(
`vn`.`buy` `b`
JOIN `vn`.`item` `i` ON(`i`.`id` = `b`.`itemFk`)
)
JOIN `cache`.`last_buy` `clb` ON(`clb`.`item_id` = `i`.`id`)
)
JOIN `vn`.`entry` `e` ON(`e`.`id` = `b`.`entryFk`)
)
LEFT JOIN `vn`.`travel` `tr` ON(`tr`.`id` = `e`.`travelFk`)
)
JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `tr`.`warehouseInFk`)
)