salix/db/install/changes/only-local/00-workerCalendar.sql

16 lines
654 B
SQL

DROP VIEW IF EXISTS `vn`.`workerCalendar`;
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`workerCalendar` AS
SELECT
`ce`.`business_id` AS `businessFk`,
`p`.`id_trabajador` AS `workerFk`,
`ce`.`calendar_state_id` AS `absenceTypeFk`,
`ce`.`date` AS `dated`
FROM
(((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`)))
JOIN `postgresql`.`business` `b` ON ((`b`.`client_id` = `pr`.`profile_id`)))
JOIN `postgresql`.`calendar_employee` `ce` ON ((`ce`.`business_id` = `b`.`business_id`)))