2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
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`
|