-1
My機能を切り上げることは、私はそれは置いアウトを与えるMySQLの小数点除算自動的
SELECT get_approved_leaves('2017-01-01','2017-12-31',18, 5) as debted
FROM `erp_employee_leave_debts` WHERE 1
呼び出すと
DELIMITER $$;
CREATE FUNCTION get_approved_leaves(f_date date, t_date date,
emp_id bigint, ltp_id int)
RETURNS INT NOT DETERMINISTIC
BEGIN
DECLARE leaves_taken decimal(10,3) DEFAULT 0.000;
SELECT SUM(eld_first+eld_second)/2
INTO leaves_taken
FROM erp_apply_leaves, erp_employee_leave_debts
WHERE al_fk_employees = emp_id
AND al_from >= f_date
AND al_to <= t_date
AND al_fk_leave_type = ltp_id
AND eld_fk_apply_leaves = al_id
AND al_status = 101;
RETURN leaves_taken;
END $$;
DELIMITER ;
です私は出力= 19.5を得る必要があります
変更は '' RETURNSにINT'返品DECIMAL' –