CREATE OR REPLACE DEFINER=`root`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`mistake`
AS SELECT `wr`.`code` AS `revisador`,
	`s`.`concept` AS `concept`,
	`w`.`code` AS `sacador`,
	`w`.`firstName` AS `firstName`,
	`w`.`lastName` AS `lastName`,
	`mt`.`description` AS `description`,
	cast(`iss`.`created` AS date) AS `created`,
	`w`.`id` AS `workerFk`
FROM (
		(
			(
				(
					(
						`vn`.`saleMistake` `sm`
						JOIN `vn`.`mistakeType` `mt` ON(`mt`.`id` = `sm`.`typeFk`)
					)
					JOIN `vn`.`worker` `wr` ON(`wr`.`id` = `sm`.`userFk`)
				)
				JOIN `vn`.`sale` `s` ON(`s`.`id` = `sm`.`saleFk`)
			)
			JOIN `vn`.`itemShelvingSale` `iss` ON(`iss`.`saleFk` = `sm`.`saleFk`)
		)
		JOIN `vn`.`worker` `w` ON(`w`.`id` = `iss`.`userFk`)
	)
