title: Fetching Record from database usin SQL Query
body: <p>I have two database tables whose structure is showing below in the image</p>
  
  <p><a href="https://i.stack.imgur.com/OZz3K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OZz3K.png" alt=""></a></p>
  
  <p>Here are some Records in these tables.</p>
  
  <p><a href="https://i.stack.imgur.com/ZHQsX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHQsX.png" alt="Records in Mechanic Table"></a></p>
  
  <p>and </p>
  
  <p><a href="https://i.stack.imgur.com/Sz17o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sz17o.png" alt="Records in Airport Table"></a></p>
  
  <p>and I am using the following SQL Query</p>
  
  <pre><code>$query = "
  SELECT CITY, SUM(MECHANIC.SALARY) AS COMBINED_SALARY FROM MECHANIC, AIRPORT
  WHERE AIRPORT.STATE = 'California'
  GROUP BY AIRPORT.CITY
  ";
  </code></pre>
  
  <p>and getting the following result
  <a href="https://i.stack.imgur.com/Sh0AG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sh0AG.png" alt="enter image description here"></a></p>
  
  <p>but this is not the required result.</p>
  
  <p>I want to list the total, combined salaries of all of the
  mechanics who work in each city in California.</p>
  
  <p>But the result is showing the total sum of all the employees' salaries.</p>
  
  <p>Does anyone know how to complete this task ?
  Any help would be much appreciated.
  Thanks in advance.</p>