CREATE OR REPLACE DEFINER=`vn`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`phoneBook` AS SELECT 'C' AS `Tipo`, `vn`.`client`.`id` AS `Id`, `vn`.`client`.`name` AS `Cliente`, `vn`.`client`.`phone` AS `Telefono` FROM `vn`.`client` WHERE `vn`.`client`.`phone` IS NOT NULL UNION SELECT 'C' AS `Tipo`, `vn`.`client`.`id` AS `Id`, `vn`.`client`.`name` AS `Cliente`, `vn`.`client`.`mobile` AS `Movil` FROM `vn`.`client` WHERE `vn`.`client`.`mobile` IS NOT NULL UNION SELECT 'C' AS `Tipo`, `vn`.`clientContact`.`clientFk` AS `clientFk`, `vn`.`clientContact`.`name` AS `name`, `vn`.`clientContact`.`phone` AS `phone` FROM `vn`.`clientContact`