Reputation: 11
I am trying to create a SQL query that does the following.
If (field-A = Value1) and (field-B = value1)
then (field-c)
So if 2 columns have a certain value I want to return the value of a third column.
Upvotes: 1
Views: 2485
Reputation: 12973
select fieldc from table where fielda='value1' and fieldb='value2'
Upvotes: 2
Reputation: 23113
try this:
case
when field-A = @value1 and field-B = @value1 then field-C
else 'whatever else you want' end
Upvotes: 3