Guys i can not find solution for this problem , its always giving syntax error what ever i have tried ... can you just cast a look for me , thanks
create procedure SP_Insert(in MatchIDP int,in TipID int, in User int)
begin
if exists(
select BetSlipID from betslips where MatchID = MatchIDP and UserID = User)
(
update Betslips set TipID = 2
)
else
(
insert into Betslips (MatchID,TipID , UserID) value (MatchIDP,TipID,User)
)
end if
end
I just want to check if data exists in table before i do insert , and i can not use "On duplicate key update" because my primary key does not mean anything , its table where i put in 2-3 foreign keys ....