salix/db/routines/vn/views/workerTimeControlUserInfo.sql

21 lines
544 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerTimeControlUserInfo`
AS SELECT `u`.`id` AS `userFk`,
`w`.`firstName` AS `name`,
`w`.`lastName` AS `surname`,
`u`.`name` AS `user`,
`u`.`password` AS `password`,
`wd`.`departmentFk` AS `departmentFk`,
left(`c`.`fi`, 8) AS `dni`
FROM (
(
(
`account`.`user` `u`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `u`.`id`)
)
JOIN `vn`.`client` `c` ON(`c`.`id` = `u`.`id`)
)
LEFT JOIN `vn`.`workerDepartment` `wd` ON(`wd`.`workerFk` = `w`.`id`)
)