2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`workerWithoutTractor`
|
|
|
|
AS SELECT `c`.`workerFk` AS `workerFk`,
|
|
|
|
`cl`.`name` AS `Trabajador`,
|
|
|
|
COUNT(DISTINCT `c`.`id`) AS `Colecciones`,
|
|
|
|
max(`c`.`created`) AS `created`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
`vn`.`collection` `c`
|
|
|
|
JOIN `vn`.`client` `cl` ON(`cl`.`id` = `c`.`workerFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`machineWorker` `mw` ON(
|
|
|
|
`mw`.`workerFk` = `c`.`workerFk`
|
|
|
|
AND `mw`.`inTimed` > `util`.`VN_CURDATE`()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
WHERE `c`.`created` > `util`.`VN_CURDATE`()
|
|
|
|
AND `mw`.`workerFk` IS NULL
|
|
|
|
GROUP BY `c`.`workerFk`
|