我是 MySQL 新手,我得到:
IF 语句的“IsTrue=1 THEN”附近的 SQL 语法错误
MySQL函数是这样的:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `GetABCD`(Var1 int, Var2 int,Var3 Int, IsTrue int) RETURNS decimal(24,14)
Return (
IF IsTrue=1 THEN
Select sum(A) E from e_pnfi
where ID = (select ID from Main where CenterID=Var1
and YourID=(Select YourID from year Where Year=Var2)) and res in (select highid from industry where mediumid=Var3)
ELSE
Select sum(A) E from e_pnfi
where ID = (select ID from Main where CenterID=Var1
and YourID=(Select YourID from year Where Year=Var2)) and res in (select highid from industry where highid=Var3)
END IF;
)
我哪里错了?有人可以帮忙吗?