I'm new in MySQL and I'm getting:
SQL syntax error near 'IsTrue=1 THEN' of the IF statement
The MySQL function is like :
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;
)
Where am I getting wrong? Can anyone help plz?