salix/db/routines/vn/views/exchangeReportSourcePreviou...

30 lines
933 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeReportSourcePrevious`
AS SELECT `exchangeInsuranceIn`.`dated` AS `dated`,
`exchangeInsuranceIn`.`amount` AS `amountIn`,
`exchangeInsuranceIn`.`rate` AS `rateIn`,
0.00 AS `amountOut`,
0.00 AS `rateOut`,
0.00 AS `amountEntry`,
0.00 AS `rateEntry`
FROM `vn`.`exchangeInsuranceIn`
UNION ALL
SELECT `exchangeInsuranceOut`.`received` AS `received`,
0.00 AS `amountIn`,
0.00 AS `ratedIn`,
`exchangeInsuranceOut`.`divisa` AS `amountOut`,
`exchangeInsuranceOut`.`rate` AS `ratedOut`,
0.00 AS `amountEntry`,
0.00 AS `rateEntry`
FROM `vn`.`exchangeInsuranceOut`
UNION ALL
SELECT `exchangeInsuranceEntry`.`dated` AS `dated`,
0.00 AS `amountIn`,
0.00 AS `ratedIn`,
0.00 AS `amountOut`,
0.00 AS `ratedOut`,
`exchangeInsuranceEntry`.`Dolares` AS `amountEntry`,
`exchangeInsuranceEntry`.`rate` AS `rateEntry`
FROM `vn`.`exchangeInsuranceEntry`