salix/db/versions/10819-blueIvy/00-firstScript.sql

19 lines
543 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketStateToday`
AS SELECT
`ts`.`ticketFk` AS `ticketFk`,
`ts`.`state` AS `state`,
`ts`.`productionOrder` AS `productionOrder`,
`ts`.`alertLevel` AS `alertLevel`,
`ts`.`userFk` AS `userFk`,
`ts`.`code` AS `code`,
`ts`.`updated` AS `updated`,
`ts`.`isPicked` AS `isPicked`
FROM
(`vn`.`ticketState` `ts`
JOIN `vn`.`ticket` `t` ON
(`t`.`id` = `ts`.`ticketFk`))
WHERE
`t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `vn`.`MIDNIGHT`(`util`.`VN_CURDATE`());