13 lines
481 B
MySQL
13 lines
481 B
MySQL
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||
|
SQL SECURITY DEFINER
|
||
|
VIEW `vn`.`exchangeInsuranceIn`
|
||
|
AS SELECT `exchangeInsuranceInPrevious`.`dated` AS `dated`,
|
||
|
sum(`exchangeInsuranceInPrevious`.`amount`) AS `amount`,
|
||
|
cast(
|
||
|
sum(
|
||
|
`exchangeInsuranceInPrevious`.`amount` * `exchangeInsuranceInPrevious`.`rate`
|
||
|
) / sum(`exchangeInsuranceInPrevious`.`amount`) AS decimal(10, 4)
|
||
|
) AS `rate`
|
||
|
FROM `vn`.`exchangeInsuranceInPrevious`
|
||
|
GROUP BY `exchangeInsuranceInPrevious`.`dated`
|