salix/db/routines/vn2008/views/v_jerarquia.sql

11 lines
378 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_jerarquia`
AS SELECT `vn2008`.`jerarquia`.`worker_id` AS `Id_Trabajador`,
`vn2008`.`jerarquia`.`boss_id` AS `boss_id`
FROM `vn2008`.`jerarquia`
UNION ALL
SELECT DISTINCT `vn2008`.`jerarquia`.`boss_id` AS `Id_Trabajador`,
`vn2008`.`jerarquia`.`boss_id` AS `boss_id`
FROM `vn2008`.`jerarquia`