salix/db/routines/vn/views/ticketDownBuffer.sql

23 lines
646 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketDownBuffer`
AS SELECT `td`.`ticketFk` AS `ticketFk`,
`td`.`created` AS `created`,
`td`.`selected` AS `selected`,
concat(`w`.`firstName`, ' ', `w`.`lastName`) AS `sacador`,
`pk`.`code` AS `parking`
FROM (
(
(
(
`vn`.`ticketDown` `td`
JOIN `vn`.`ticketParking` `tp` ON(`tp`.`ticketFk` = `td`.`ticketFk`)
)
JOIN `vn`.`parking` `pk` ON(`pk`.`id` = `tp`.`parkingFk`)
)
JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticket` = `td`.`ticketFk`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `tst`.`worker`)
)
WHERE `td`.`selected` = 2