title: Condition SQL Server
body: <p>This is my problem: I added a column <code>Cause</code> to my table. This column contains different conditions (up to here, everything is fine). But since I have a lot of lines for each product, it can have 3 conditions at the same time. </p>
  
  <p>What I'm trying to do is that once it finds a condition, it does not go to the one after (and it is by this order of priority).</p>
  
  <p>I do not know if I was clear, but if you want more explanation do not hesitate to ask me questions</p>
  
  <pre><code>Cause = (CASE
              WHEN Four IS NOT NULL THEN 'Retards'
              WHEN (MAX(DateP BETWEEN '2018-10-24' AND '2018-10-14') THEN 'stock'
              WHEN Reference = 0  THEN 'respecté'
              WHEN Produit = 2 THEN 'non respecté'
              ELSE 'Erreur'
           END)
  </code></pre>
  
  <p>This is an example of what I want to do:
  <a href="https://i.stack.imgur.com/k25SO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k25SO.png" alt="This is an example of what I want to do"></a></p>