title: How to implement a search query across two tables?
body: <p>I'm implementing a very simple search function for my webpage. There is a table name tasks that has 4 columns of interest: name, descritption, status (last one is a multiple choice with three possible choices) and username.</p>
  
  <p>So I do the search like this:</p>
  
  <pre><code>SELECT * FROM tasks WHERE ((description LIKE '%search_val%' OR name LIKE '%search_val%') AND status='selected_status')
  </code></pre>
  
  <p>For all intents and purposes this works. However now I realized that I want the search pattern entered by the user (the above sentence is executed in PHP code) to also be able to search in the columns name and lastname of a different table: table users. If there is a task for the username (the field common to both tables) then also be a result of the query.</p>
  
  <p>So say, a user enters John in the search box. I want to show any tasks with a username with a user that has John as a lastname or first name AND show me any tasks that contain John in the description or task name.</p>
  
  <p>How would I write the query for this?</p>