CREATE OR REPLACE DEFINER=`vn`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`ticketState` AS SELECT `tt`.`created` AS `updated`, `tt`.`stateFk` AS `stateFk`, `tt`.`userFk` AS `userFk`, `tls`.`ticketFk` AS `ticketFk`, `s`.`id` AS `state`, `s`.`order` AS `productionOrder`, `s`.`alertLevel` AS `alertLevel`, `s`.`code` AS `code`, `s`.`isPreviousPreparable` AS `isPreviousPreparable`, `s`.`isPicked` AS `isPicked` FROM ( ( `vn`.`ticketLastState` `tls` JOIN `vn`.`ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`) ) JOIN `vn`.`state` `s` ON(`s`.`id` = `tt`.`stateFk`) )