refs #6444 change code according to sql conventions
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
da2a2b5f09
commit
7b1a0e1957
|
@ -1,19 +1,21 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(intINSTRASTAT INTEGER,intUNIDADES INTEGER)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(vIntrastat INT, vUnidades INT)
|
||||||
RETURNS double
|
RETURNS double
|
||||||
DETERMINISTIC
|
DETERMINISTIC
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
DECLARE n DOUBLE;
|
DECLARE vNet DOUBLE;
|
||||||
|
|
||||||
SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM
|
SELECT ROUND(vUnidades / (SUM(media) / COUNT(media)), 2) INTO vNet
|
||||||
(SELECT *, unidades / neto MEDIA
|
FROM (SELECT *, unidades / neto media
|
||||||
FROM vn2008.intrastat_data
|
FROM vn2008.intrastat_data
|
||||||
WHERE intrastat_id = intINSTRASTAT AND neto
|
WHERE intrastat_id = vIntrastat
|
||||||
AND unidades > 0
|
AND neto
|
||||||
ORDER BY odbc_date DESC
|
AND unidades > 0
|
||||||
LIMIT 20) t;
|
ORDER BY odbc_date DESC
|
||||||
RETURN n/2;
|
LIMIT 20) t;
|
||||||
|
|
||||||
|
RETURN vNet/2;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
Loading…
Reference in New Issue