title: Select Negative values only if exists in SQL Server
body: <p>i am new to sql server. i am having some problem when selecting values for report. i am having the following columns:</p>
  
  <pre><code>name, snap, current, percent.
  </code></pre>
  
  <p>i want to select only negative values if exists in the column "percent" if not select +ve values only.</p>
  
  <p>for example:</p>
  
  <p>if i am having -1, -10, 0, 10 then it should select only -1, -10. </p>
  
  <p>i tried the following query, but its giving both +ve and -ve values.</p>
  
  <pre><code>selectname, snap, current, percent 
  where percent = 
  CASE WHEN percent &lt; 0 then percent 
  when percent &gt; 0 then percent
  </code></pre>
  
  <p>i don't know how to use if else in where condition. Can anyone help me out ? Thanks in advance.</p>