17 lines
580 B
MySQL
17 lines
580 B
MySQL
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||
|
SQL SECURITY DEFINER
|
||
|
VIEW `vn2008`.`v_xsubprov`
|
||
|
AS SELECT `recibida`.`proveedor_id` AS `proveedor_id`,
|
||
|
`recibida`.`empresa_id` AS `empresa_id`
|
||
|
FROM `vn2008`.`recibida`
|
||
|
WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
|
||
|
GROUP BY `recibida`.`proveedor_id`,
|
||
|
`recibida`.`empresa_id`
|
||
|
UNION ALL
|
||
|
SELECT `pago`.`id_proveedor` AS `id_proveedor`,
|
||
|
`pago`.`empresa_id` AS `empresa_id`
|
||
|
FROM `vn2008`.`pago`
|
||
|
WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
|
||
|
GROUP BY `pago`.`id_proveedor`,
|
||
|
`pago`.`empresa_id`
|