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

11 lines
292 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`vn-admin`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`personMedia`
AS SELECT `c`.`id` AS `workerFk`,
IFNULL(`c`.`mobile`, `c`.`phone`) AS `mediaValue`
FROM (
`vn`.`client` `c`
JOIN `vn`.`worker` `w` ON(`w`.`id` = `c`.`id`)
)
HAVING `mediaValue` IS NOT NULL