Guys, I canβt find a solution to this problem, always giving a syntax error that I have ever tried ... can you just take a look at 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 the data exists in the table before I insert it, and I cannot use "On duplicate key update" because my primary key does not mean anything, its a table where I put 2-3 foreign keys. ...
source share