23 lines
537 B
SQL
23 lines
537 B
SQL
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
|
SQL SECURITY DEFINER
|
|
VIEW `vn`.`operatorWorkerCode`
|
|
AS SELECT `o`.`workerFk` AS `workerFk`,
|
|
concat(`w`.`firstName`, ' ', `w`.`lastName`) AS `fullName`,
|
|
`w`.`code` AS `code`,
|
|
`o`.`numberOfWagons` AS `numberOfWagons`
|
|
FROM (
|
|
(
|
|
`vn`.`worker` `w`
|
|
JOIN `vn`.`operator` `o` ON(`o`.`workerFk` = `w`.`id`)
|
|
)
|
|
JOIN `vn`.`sector` `s` ON(`o`.`sectorFk` = `s`.`id`)
|
|
)
|
|
WHERE `o`.`sectorFk` IS NOT NULL
|
|
AND `s`.`code` IN (
|
|
'H2',
|
|
'H2',
|
|
'PEQUES_H',
|
|
'ALTILLO COMP',
|
|
'ALTILLO ARTI'
|
|
)
|