13 lines
490 B
MySQL
13 lines
490 B
MySQL
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||
|
SQL SECURITY DEFINER
|
||
|
VIEW `sage`.`clientLastTwoMonths`
|
||
|
AS SELECT `vn`.`invoiceOut`.`clientFk` AS `clientFk`,
|
||
|
`vn`.`invoiceOut`.`companyFk` AS `companyFk`
|
||
|
FROM `vn`.`invoiceOut`
|
||
|
WHERE `vn`.`invoiceOut`.`issued` > `util`.`VN_CURDATE`() - INTERVAL 2 MONTH
|
||
|
UNION
|
||
|
SELECT `vn`.`receipt`.`clientFk` AS `clientFk`,
|
||
|
`vn`.`receipt`.`companyFk` AS `companyFk`
|
||
|
FROM `vn`.`receipt`
|
||
|
WHERE `vn`.`receipt`.`payed` > `util`.`VN_CURDATE`() - INTERVAL 2 MONTH
|