title: case statement to find one value
body: <p>I'm trying to show one row per id but it is returning three. </p>
  
  <p>If the id has a 'y' then it should show a 'y'. </p>
  
  <p>If it shows a 'y' and 'r' it should be 'y'. </p>
  
  <p>If it has 'y', 'r', 'n' it should be 'y'. </p>
  
  <p>If it is just id and 'r' it should be 'r' and id and just 'n' then 'n'. </p>
  
  <p>I can't seem to get it to work using a case statement. Any ideas? Thanks. </p>
  
  <p>I've tried this:</p>
  
  <pre><code>,CASE WHEN result = 'Y' THEN 'Y'
        WHEN result = 'Y' AND result = 'R') THEN 'Y'
        WHEN result = 'R' THEN 'R'
        ELSE 'N' END AS CARE_PLAN
  </code></pre>
  
  <p>What it is returning:</p>
  
  <pre><code>ID    result
  3434   'y'
  3434   'r'
  3434   'n'
  </code></pre>