title: Healthcare delivery SQL
body: <p>I'm having an issue with a practice assessment regarding a health dataset. I have been tasked with counting the total number of emergency room visits for individuals diagnosed with schizophrenia with the conditions that anyone with icd10_category = f20 needs to have all of the records recorded. I was originally thinking that I should use an IF else statement because I come from a back end mindset however, I've never done anything like this in sql and I'm having a hard time finding documentation for this issue. Below I have a mockup of the code I had theorized but I don't know if this will work. Can someone please help? This is also my first time posting so any guidance or constructive criticism is better than heavy judgements :)</p>
  <pre><code>begin
  
  declare @newId varchar
  declare @sum int
  
  
  select * from dbo.['Test dataset - SQL - Sep# 2021 $']
  
  
  /*
  
  If icd10_category == 'f20'
  id=newId;
  +=newId;
  
  
  else
  return;
  
  
  return sum(newId);
  */
  </code></pre>