2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
2024-01-25 16:33:54 +00:00
|
|
|
VIEW `vn`.`expeditionRoute_freeTickets`
|
|
|
|
AS SELECT `t`.`routeFk` AS `routeFk`,
|
|
|
|
`tss`.`ticketFk` AS `ticket`,
|
|
|
|
`s`.`name` AS `code`,
|
|
|
|
`w`.`name` AS `almacen`,
|
|
|
|
`tss`.`updated` AS `updated`,
|
|
|
|
`p`.`code` AS `parkingCode`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`vn`.`ticketState` `tss`
|
|
|
|
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `tss`.`ticketFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`state` `s` ON(`s`.`id` = `tss`.`state`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`ticketParking` `tp` ON(`tp`.`ticketFk` = `t`.`id`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `tp`.`parkingFk`)
|
|
|
|
)
|
|
|
|
WHERE IFNULL(`t`.`packages`, 0) = 0
|