1

次のことを行う SQL クエリを作成しようとしています。

If (field-A = Value1) and (field-B = value1)
then (field-c)

したがって、2 つの列に特定の値がある場合、3 番目の列の値を返したいとします。

4

2 に答える 2

3

これを試して:

case 
  when field-A = @value1 and field-B = @value1 then field-C 
  else 'whatever else you want' end
于 2012-04-22T22:13:35.307 に答える
2

select fieldc from table where fielda='value1' and fieldb='value2'

于 2012-04-22T22:13:59.643 に答える