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