title: SQL - Finding out how to write a case statement depending on how many times a name shows up in a column
body: <p>I need some help with an SQL exercise that has me completely stumped. For an assignment, I have a question asking me to print a list of names with different descriptions attached depending on how many times they appear in a pre-existing list. The question verbatim is posted below for reference:</p>
  <p>SI schema contains customers that have bought one or more vehicles. They can be classified using the following criteria:</p>
  <ul>
  <li>Customers that have bought only one car (one-time buyer)</li>
  <li>Customer that have bought two cars (two-time buyer)</li>
  <li>Customers that have bought more than two cars (frequent buyer)</li>
  </ul>
  <p>Using a SINGLE SELECT statement, display a list of customers with their names and what type of buyer they are for all those customers that have bought Jaguar car makes.</p>
  <p>The code I have written is posted here:</p>
  <pre><code>use si;
  
  select saleinv.custname,
      count(case
      when saleinv.custname = 1
          then 'One-Time Purchaser'
      when saleinv.custname = 2
          then 'Two-Time Purchaser'
      else
          'Frequent Purchaser'
      
  end) as &quot;purchtype&quot;
  from si.saleinv
  
  inner join si.car
  on car.custname = saleinv.custname
  where (car.carmake like 'JAGUAR');
  </code></pre>
  <p>That is just what I have currently -- I am constantly taking things out and adding things and rearranging things -- nothing seems to work. I am being met with error after error. I have been trying to follow along with any CASE statement resources I can find including the ones provided to me by my instructor, but nothing seems to be helping me. There are plenty of resources detailing what to do in regards to working with directly assigned values, but never anything related to I'm supposed to use this to find the amount of items that appear in a list. It doesn't matter how well I follow along with example code, my IDE just isn't liking what I am putting in.</p>
  <p>I don't want any outright changes to my code, I just want somebody to point out what I'm doing wrong because at the moment, I have no clue whatsoever.</p>
  <p>I am brand new to StackOverflow (in terms of actually posting content on the site), so I may not know how to navigate replies and posts and such, but I'll do my best.</p>
  <p>Thank you all.</p>