title: Merging the results of two sql queries in PHP
body: <p>I'm trying to implement a search function that not only search in one table (tasks) but also in another related table (activities). Activities has a column name task that identifies the task it belongs to (which is the column keyid in the tasks table). The way I search the task table is:</p>
  
  <pre><code>SELECT
      tasks.*
  FROM
      tasks
  WHERE
      (
          (
              tasks.description LIKE '%$search%'
              OR tasks. NAME LIKE '$search%'
          )
          AND tasks. USER = '$userid'
      );
  </code></pre>
  
  <p>The way I search the activities table is:</p>
  
  <pre><code>SELECT DISTINCT
      tasks.*
  FROM
      activities,
      tasks
  WHERE
      tasks. USER = '1'
  AND activities.description LIKE '%$search%';
  </code></pre>
  
  <p>The individual queries work and they both return task table data. What I want to do is merge both results (in php) so that I only get all the table tasks entries with no repetition.</p>
  
  <p>How can I do this?</p>