Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to use CASE instead of If

$
0
0

Could someone please help me on how I would use CASE or ? in the example query below?  Thank You

Select col,
if col1 = '0' and col2 = '0' then
  set test = '175'
  else if col1 = '0' and col2 = '1' then
  set test = '152'
  else if col1 = '1' and col2 = '0' then
  set test = '135'
  else
  set test = '100'

End
From table


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>