CREATE OR REPLACE DEFINER=`vn`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`saleMistake_list__2` AS SELECT `st`.`saleFk` AS `saleFk`, `st`.`workerFk` AS `workerFk`, concat(`w2`.`firstName`, ' ', `w2`.`lastName`) AS `sacador`, `st`.`created` AS `created`, concat(`w`.`firstName`, ' ', `w`.`lastName`) AS `revisador`, `mt`.`description` AS `description`, `sm`.`created` AS `controlled` FROM ( ( ( ( ( `vn`.`saleTracking` `st` JOIN `vn`.`worker` `w2` ON(`w2`.`id` = `st`.`workerFk`) ) JOIN `vn`.`state` `s` ON( `s`.`id` = `st`.`stateFk` AND `s`.`code` IN ('PREVIOUS_PREPARATION', 'PREPARED', 'OK') ) ) LEFT JOIN `vn`.`saleMistake` `sm` ON(`st`.`saleFk` = `sm`.`saleFk`) ) LEFT JOIN `vn`.`mistakeType` `mt` ON(`mt`.`id` = `sm`.`typeFk`) ) LEFT JOIN `vn`.`worker` `w` ON(`w`.`id` = `sm`.`userFk`) )