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

17 lines
440 B
MySQL
Raw Permalink Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`salesPersonSince`
AS SELECT `b`.`workerFk` AS `workerFk`,
min(`b`.`started`) AS `started`
FROM (
(
`vn`.`business` `b`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `b`.`workerFk`)
)
LEFT JOIN `vn`.`professionalCategory` `pc` ON(
`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`
)
)
WHERE `pc`.`description` = 'Aux ventas'
GROUP BY `b`.`workerFk`