我正在处理以下简单查询。我想加入小队并分组 g 表但有条件(@ZeroOrOne 参数将为 0 或 1)
WHERE
CASE WHEN IsNumeric(@ZeroOrOne) = 0 THEN
s.TeamId=g.Team1Id --if @ZeroOrOne value is 0 then perform this statement
ELSE
s.TeamId=g.Team2Id --if @ZeroOrOne value is 1 then perform this statement
什么是正确的方法;我应该更改我的查询或逻辑吗?