title: How to combine aggregate, join, and grouped by?
body: <p>table one:  </p>
  
  <pre><code>dept-----job------salary  
  01......nurse .....1000  
  02......driver.....2000  
  02......doctor.....5000  
  01.......pilot.....2000  
  </code></pre>
  
  <p>table two:  </p>
  
  <pre><code>dept------location  
  01..........Japan  
  02..........New York  
  </code></pre>
  
  <p>I'm trying to get the average salary for each job by location.  </p>
  
  <p>This is what I came up with (obviously incorrect)  </p>
  
  <pre><code>SELECT two.location, one.job, AVG(one.sal)  
  FROM one, two  
  WHERE one.dept = two.dept  
  GROUPED BY two.loc, one.job;  
  </code></pre>
  
  <p>Any ideas what I'm doing wrong? (Apologies for awful table format)</p>