title: SQL Server Remove unwanted rows from a CASE statement
body: <p>I do a SELECT with a CASE statement with this following:</p>
  
  <pre><code>SELECT DISTINCT
  n.NiveauId, n.Description,
  CASE WHEN n.NiveauId NOT IN (SELECT ccs.idNiveau WHERE ccs.centreCout = 60001) THEN 0 ELSE 1 END AS attribue
  FROM pa.dbo.Niveau n
  JOIN BDC.dbo.CentreCoutSecteur ccs ON n.NiveauId = ccs.idNiveau
  </code></pre>
  
  <p>Explication :
  In case "NiveauId" is not present in the other table, the value of "attribue" is 0. Else, if it's present, the value is 1.</p>
  
  <p>This works, but every rows that contains a 1 also shows the same row with a 0.</p>
  
  <p>Exemple:</p>
  
  <p><a href="https://i.stack.imgur.com/JjDtA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JjDtA.jpg" alt="enter image description here"></a></p>
  
  <p>How would I change the SELECT query to remove the unwanted duplicate rows that contain 0?</p>
  
  <p>Thanks in advance!</p>