18 lines
764 B
SQL
18 lines
764 B
SQL
DROP VIEW IF EXISTS `vn`.`workerLabour`;
|
|
CREATE
|
|
ALGORITHM = UNDEFINED
|
|
DEFINER = `root`@`%`
|
|
SQL SECURITY DEFINER
|
|
VIEW `vn`.`workerLabour` AS
|
|
SELECT
|
|
`b`.`business_id` AS `businessFk`,
|
|
`p`.`id_trabajador` AS `workerFk`,
|
|
`bl`.`workcenter_id` AS `workCenterFk`,
|
|
`b`.`date_start` AS `started`,
|
|
`b`.`date_end` AS `ended`,
|
|
`d`.`id` AS `departmentFk`
|
|
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`.`business_labour` `bl` ON `b`.`business_id` = `bl`.`business_id`
|
|
JOIN `vn`.`department` `d` ON `d`.`id` = `bl`.`department_id` |