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

14 lines
473 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerTimeJourneyNG`
AS SELECT `wtc`.`userFk` AS `userFk`,
cast(`wtc`.`timed` AS date) AS `dated`,
IF(`wtc`.`order` MOD 2, -1, 1) * (HOUR(`wtc`.`timed`) + MINUTE(`wtc`.`timed`) / 60) AS `Journey`,
dayname(`wtc`.`timed`) AS `dayName`,
`w`.`lastName` AS `name`,
`w`.`firstName` AS `firstname`
FROM (
`vn`.`workerTimeControl` `wtc`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `wtc`.`userFk`)
)