title: How to fix 'subquery returns more than 1 row' with variable tables
body: <p>I have a table <code>RAW_SCORES</code> that contains a bunch of homework/exam grades. There is a row in <code>RAW_SCORES</code> that contains the max points for each assignment. </p>
  
  <pre><code>('6410', 'Rivera',  'Rhonda',  '315', 64,  64, 28, 85,   98, 152),
  ('0001', 'MAX', 'POINTS',      '415', 100, 80, 32, 100, 120, 200),
  </code></pre>
  
  <p>I want to create a procedure that prints a table with the (Raw Score / Max Score) for each assignment. So for assignment 1:</p>
  
  <pre><code>SET hw1M = (SELECT HW1 FROM RAW_SCORES WHERE (SSN = '0001'));
  SELECT RAW_SCORES.SSN,
      RAW_SCORES.FName,
      RAW_SCORES.LName,
      ROUND(RAW_SCORES.HW1 / hw1M, 2)
  FROM RAW_SCORES WHERE NOT (RAW_SCORES.SSN = '0001' OR RAW_SCORES.SSN = '0002');
  </code></pre>
  
  <p>Gives me the correct result for HW1, but the table header says Round(bla bla bla) and the question wants it to be printed as HW1Pct. So I tried:</p>
  
  <pre><code>SET hw1M = (SELECT HW1 FROM RAW_SCORES WHERE (SSN = '0001'));
  SET HW1Pct = (SELECT ROUND(RAW_SCORES.HW1 / hw1M, 2) FROM RAW_SCORES WHERE hw1M IN (SELECT HW1 FROM RAW_SCORES WHERE (SSN = '0001')));
  SELECT RAW_SCORES.SSN,
      RAW_SCORES.FName,
      RAW_SCORES.LName,
      HW1Pct
  FROM RAW_SCORES WHERE NOT (RAW_SCORES.SSN = '0001' OR RAW_SCORES.SSN = '0002');
  </code></pre>
  
  <p>But this gives me the <code>Subquery returns more than 1 row</code> error. Most of the other answers to this error are a <code>JOIN</code> statement, but I'm not sure how I would implement that in my case. Any help is appreciated. Sorry for it being a dumb question.</p>