这需要获胜的玩家并将他们放入tblEntrants准备下一轮抽签。它工作正常,但我需要添加一个CASE部分,如果被检查的对手有一个BYE,将添加Player1或Player2 ..
例如......当ResultPlayer2> resultPLayer1那么玩家2或(当玩家对手名字=“再见”时,将对手通过BYE)
DELETE tblEntrants where compID=@compID
INSERT INTO tblEntrants(AccountID,compID, paid)
SELECT CASE WHEN ResultPlayer2 > resultPLayer1 THEN Player2 ELSE Player1 END, CompID, 'y'
FROM tblfixtures WHERE round=@round
答案 0 :(得分:0)
你可以使用它。
DELETE tblEntrants where compID=@compID
INSERT INTO tblEntrants(AccountID,compID, paid)
SELECT
CASE
WHEN Player1 ='BYE' THEN Player2
WHEN Player2 ='BYE' THEN Player1
WHEN ResultPlayer2 > ResultPlayer1 THEN Player2
ELSE Player1 END,
CompID, 'y'
FROM tblfixtures WHERE round=@round