title: Error Code: 1054. Unknown column in 'on clause'
body: <p>The query is meant to return the percentage based on value from one table being divided by the value of another table. However, there is something wrong and I am missing it. </p>
  
  <p>similar problems noted on the board looked related to JOIN, but did not seem to be the problem, when I tried and explicit join -- basically mysql was like -- now you are an idiot-- I must have did that wrong or that is not the problem.  </p>
  
  <pre><code>    SELECT (pathogenPop / locationpop) as PercentInfected
         FROM ( 
         (SELECT apinfectcount.APInfectCountInfected 
         as pathogenPop, apinfectcount.APInfectCountLocation
         FROM apstart.apinfectcount 
         GROUP BY apinfectcount.APInfectCountLocation) as pathogenPop
  
             Inner JOIN 
  
         (SELECT apcountrypop.apcountrypopPopulation 
         as locationpop, apcountrypop.apcountrypopCountry
         FROM apstart.apcountrypop 
         GROUP BY apcountrypop.apcountrypopCountry) 
         as locationpop
         on apinfectcount.APInfectCountLocation = apcountrypop.apcountrypopCountry 
         and apinfectcount.APInfectCountWeek = 23);
  </code></pre>
  
  <p><strong>Table Schema:</strong> apcountrypop</p>
  
  <pre><code>    idapcountrypop          INT(11)
      apcountrypopCountry     VarChar(45)
      apcountrypopPopulation  FLOAT
  </code></pre>
  
  <p><strong>Table Schema:</strong> apinfectcount</p>
  
  <pre><code>    idAPInfectCount         INT(11)
      APInfectCountLocation   VarChar(45)
      APInfectCountOutBreak   VarChar(45)
      APInfectCountPathogen   VarChar(45)
      APInfectCountInfected   FLOAT
      APInfectCountDead       FLOAT
      APInfectCountWeek       VarChar(45)
  </code></pre>
  
  <p>If it worked -- 
  it would assign apinfectcount.APInfectCountInfected to pathogenPop
  and apcountrypop.apcountrypopPopulation to locationpop</p>
  
  <p>for the values where the locations are the same(apinfectcount.APInfectCountLocation = apcountrypop.apcountrypopCountry)</p>
  
  <p>then it would return the value of the apinfectcount table value is divided by the apcountrypop table to give the percentage.</p>
  
  <p>so in this specific example I only have sample data so I am just wanted to return one value so I added the where clause to just test the logic and syntax.</p>
  
  <p>I appreciate the help.</p>