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

26 lines
722 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_empresa`
AS SELECT `e`.`logo` AS `logo`,
`e`.`id` AS `id`,
`e`.`registro` AS `registro`,
`e`.`gerente_id` AS `gerente_id`,
`e`.`alta` AS `alta`,
`t`.`Nombre` AS `Nombre`,
`t`.`Apellidos` AS `Apellidos`,
`p`.`Proveedor` AS `Proveedor`,
`p`.`Domicilio` AS `Domicilio`,
`p`.`codpos` AS `CP`,
`p`.`Localidad` AS `Localidad`,
`p`.`NIF` AS `NIF`,
`p`.`Telefono` AS `Telefono`,
`p`.`Alias` AS `Alias`,
`e`.`abbreviation` AS `abbreviation`
FROM (
(
`vn2008`.`empresa` `e`
JOIN `vn2008`.`Trabajadores` `t` ON(`t`.`Id_Trabajador` = `e`.`gerente_id`)
)
JOIN `vn2008`.`Proveedores` `p` ON(`p`.`Id_Proveedor` = `e`.`id`)
)