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

11 lines
288 B
SQL

CREATE OR REPLACE DEFINER=`root`@`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