title: How to get the average salary of each department from two separate tables
body: <p>I have two separate tables dept_emp and salaries. dept_emp contains the emp_no and dept_no while the salaries contains the salary and the emp_no. I think that I have to join the emp_no from both tables for me to get the dept_no of every employee then get the average of the salaries for every department.</p>
  
  <pre><code>SELECT `AVG(salaries.salary)`, dept_emp.dept_id  
  FROM `salaries` 
  INNER JOIN dept_emp
  IN salaries.emp_no = dept_emp.emp_no 
  GROUP BY dept_emp.dept_id;
  </code></pre>
  
  <p>I tried this on but it doesn't work can you please suggest another way or concept for me to solve this?</p>