CREATE OR REPLACE DEFINER=`vn`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`itemShelvingPlacementSupplyStock`
AS SELECT `ish`.`id` AS `itemShelvingFk`,
	`ish`.`itemFk` AS `itemFk`,
	`ish`.`packing` AS `packing`,
	`ish`.`visible` AS `stock`,
	`i`.`longName` AS `longName`,
	`i`.`size` AS `size`,
	`i`.`subName` AS `subName`,
	`sh`.`code` AS `shelving`,
	`p`.`code` AS `parking`,
	`ish`.`created` AS `created`,
	IFNULL(`sh`.`priority`, 1) AS `priority`,
	`p`.`id` AS `parkingFk`,
	`p`.`sectorFk` AS `sectorFk`
FROM (
		(
			(
				`vn`.`itemShelving` `ish`
				JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
			)
			LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
		)
		JOIN `vn`.`item` `i` ON(`i`.`id` = `ish`.`itemFk`)
	)
GROUP BY `ish`.`id`
