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

24 lines
678 B
MySQL
Raw Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketLastUpdatedList`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
`st`.`created` AS `created`
FROM (
`vn`.`saleTracking` `st`
JOIN `vn`.`sale` `s` ON(`s`.`id` = `st`.`saleFk`)
)
WHERE `st`.`created` > `util`.`VN_CURDATE`()
UNION ALL
SELECT `tt`.`ticketFk` AS `Id_Ticket`,
`tt`.`created` AS `odbc_date`
FROM `vn`.`ticketTracking` `tt`
WHERE `tt`.`created` > `util`.`VN_CURDATE`()
UNION ALL
SELECT `s`.`ticketFk` AS `ticketFk`,
`iss`.`created` AS `created`
FROM (
`vn`.`itemShelvingSale` `iss`
JOIN `vn`.`sale` `s` ON(`s`.`id` = `iss`.`saleFk`)
)
WHERE `iss`.`created` > `util`.`VN_CURDATE`()