title: How to recreate this logic using a sql case statement
body: <pre><code>SELECT
  
      'IsActive' = 
  
  FROM Users u
      INNER JOIN Permissions p ON u.Id = p.UserId
  </code></pre>
  
  <p>I need to add some logic to the above query to get the same result as if I was doing the below (which is pseudo code).</p>
  
  <p>Is this possible with a case statement?</p>
  
  <pre><code>if( 
      (p.Approved &amp;&amp; 
          (p.secondaryApproval == null ||  (p.SecondaryApproval != null &amp;&amp; p.secondaryApproval)
      )
    )
  </code></pre>
  
  <p>The logic in the <code>if</code> statement above determines with <code>IsActive</code> should be true.</p>
  
  <p>Can I somehow use a sql case statement to <code>mimick</code> this logic in my query?</p>