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`()
