title: SQL query for 2 different tables
body: <p>I have tables:</p>
  
  <ol>
  <li>Trips: Trip_Num, Trip_Type, etc.</li>
  <li>User's Trips History: Username, Trip_Num, etc.</li>
  </ol>
  
  <p>I am doing a project in php and need to do a SQL query for a specific user (by his username) - need to know the Trip_Type for the Trip_Num in the User's Trips History table.</p>
  
  <p>Attached the tables I have:</p>
  
  <p><strong>Trips</strong></p>
  
  <p><a href="https://i.stack.imgur.com/xbYlp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xbYlp.png" alt="enter image description here"></a></p>
  
  <p><strong>User's Trips History</strong></p>
  
  <p><a href="https://i.stack.imgur.com/XfKwg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XfKwg.png" alt="enter image description here"></a> </p>
  
  <p>Update:
  I need to do count on each value in the Trip_type. I mean I want to see "on foot" - 4 occurences, "Bicycle" - 3 occurences, this is good?...........................................................................‌​ select Trips_History.*,Trips.Trip_Type, COUNT(Trip_Type) AS Trip_Type_occurrence FROM Trips History INNER JOIN Trips on Trips_History.Trip_Num = Trips.Trip_Num GROUP BY Trip_Type ORDER BY Trip_Type_occurrence DESC – </p>