salix/services/db/install/changes/1.2-CHECK/15-personMedia.sql

18 lines
673 B
MySQL
Raw Normal View History

USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `personMedia` AS
SELECT
`p`.`id_trabajador` AS `workerFk`,
`m`.`value` AS `mediaValue`
FROM
((((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`)))
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`)))
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`)))
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`)))
WHERE
(`mt`.`name` = 'movil empresa');