2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`workerBusinessDated`
|
|
|
|
AS SELECT `t`.`dated` AS `dated`,
|
|
|
|
`b`.`id` AS `businessFk`,
|
|
|
|
`b`.`workerFk` AS `workerFk`
|
|
|
|
FROM (
|
|
|
|
`vn`.`time` `t`
|
|
|
|
LEFT JOIN `vn`.`business` `b` ON(
|
|
|
|
`t`.`dated` BETWEEN `b`.`started` AND IFNULL(`b`.`ended`, `util`.`VN_CURDATE`())
|
|
|
|
)
|
|
|
|
)
|
|
|
|
WHERE `t`.`dated` > `util`.`VN_CURDATE`() + INTERVAL -2 year
|