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 $$
|
||||
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
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE n DOUBLE;
|
||||
DECLARE vNet DOUBLE;
|
||||
|
||||
SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM
|
||||
(SELECT *, unidades / neto MEDIA
|
||||
FROM vn2008.intrastat_data
|
||||
WHERE intrastat_id = intINSTRASTAT AND neto
|
||||
AND unidades > 0
|
||||
ORDER BY odbc_date DESC
|
||||
LIMIT 20) t;
|
||||
RETURN n/2;
|
||||
SELECT ROUND(vUnidades / (SUM(media) / COUNT(media)), 2) INTO vNet
|
||||
FROM (SELECT *, unidades / neto media
|
||||
FROM vn2008.intrastat_data
|
||||
WHERE intrastat_id = vIntrastat
|
||||
AND neto
|
||||
AND unidades > 0
|
||||
ORDER BY odbc_date DESC
|
||||
LIMIT 20) t;
|
||||
|
||||
RETURN vNet/2;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue