0
我想從這個大小寫參數的巢中的2個值,所以我可以將它們插入結果表來檢查匹配,然後我更新#game
表的結果。我已將更新作爲select語句的一部分。 我得到我怎樣才能得到嵌套的大小寫參數返回值
無效列錯誤
在standard_matches
和bonus_match
。 然後我嘗試在case參數和相同的錯誤後獲取一個值。 這是大小寫參數代碼。
BEGIN --
-- update #game set gwn = standard_matches ,gsn = bonus_match from
-- where gameno = 1
-- from
SELECT
@Ball1 AS Ball1,
@Ball2 AS Ball2,
@Ball3 AS Ball3,
@Ball4 AS Ball4,
@Ball5 AS Ball5,
@Ball6 AS Ball6,
standard_matches
bonus_match
from #draws
CROSS APPLY
(SELECT
CASE WHEN Winningball1 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 end +
CASE WHEN Winningball2 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 ENd +
CASE WHEN Winningball3 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END +
CASE WHEN Winningball4 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END +
CASE WHEN Winningball5 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END +
CASE WHEN Winningball6 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END as standard_matches,
CASE WHEN Bonusball1 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END +
CASE WHEN Bonusball2 IN (@Ball1, @Ball2, @Ball3, @Ball4, @Ball5, @Ball6) THEN 1 END as bonus_match
) AS ca1
set @sm = standard_matches
set @bm = bonus_match
update #game set gwn = @sm ,gsn = @bm where gno = 1
end
感謝您的回答,我仍然在select和update語句中獲得了standard_matches和bonus_match的錯誤無效列名稱。案例參數可以看到列爲int – Gary
你可以發佈你的最新查詢嗎? – Squirrel
嗨松鼠列名不一樣這是代碼 – Gary