title: Combining the results of two separate MySQL queries
body: <p>I'm trying to do two separate database quires and return the results to a form. Each result is written to a table.</p>
  
  <p>I want to be able to combine the two queries into one and order the results by  task number. </p>
  
  <p>FIRST QUERY:</p>
  
  <pre><code> //Booking  
      $Date= date("d/m/Y");
      $driver = $_SESSION['username'];
      $dbTaskRecords = "SELECT * FROM booking WHERE driver='$driver' AND Date= CAST('$Date_search' AS DATE) ORDER BY TaskNo ASC"; 
      $dbTaskRecords_result = mysql_query($dbTaskRecords);
  </code></pre>
  
  <p>SECOND QUERY:</p>
  
  <pre><code>//Return Booking    
      $dbTaskReturn = "SELECT * FROM returnbooking WHERE driver='$driver' AND Date= CAST('$Date_search' AS DATE) ORDER BY TaskNo ASC";    
      $dbTaskReturn_result = mysql_query($dbTaskReturn);
  </code></pre>
  
  <p>The results are then outputted to the page through a while statement. </p>
  
  <pre><code>$i=0;
          while ($row = mysql_fetch_array($dbTaskRecords_result)){
          //Control Structure for Move Time on first Job of day           
          if ($i==0 ){
          $time = $row["Time"];
          //$time = 'N/A';
  
          }else{
              $time = 'N/A';
          }
  
          //Get Rego from trucks table        
          $truckID = $row["TruckID"];
          $Rego_select = mysql_query("SELECT VechicleRegistration FROM trucks WHERE TruckID = '$truckID'" )
          or die("Problem reading table: " . mysql_error());
          $Rego = mysql_result($Rego_select,0);
  
          //Get unregisted from trucks table
          $Unregisted_select = mysql_query("SELECT Unregistered FROM trucks WHERE TruckID = '$truckID'" )
          or die("Problem reading table: " . mysql_error());
          $Unregisted = mysql_result($Unregisted_select,0); 
  
          $id_note = $row["BookingID"];           
  
  
                  echo    '&lt;td&gt;&lt;a href="taskpage.php?id='.$id_note.'"&gt;&lt;button&gt;'. $row['TaskNo']."&lt;/button&gt;&lt;a/&gt;&lt;/td&gt;";
                  echo    "&lt;td&gt;". $time . "&lt;/td&gt;";                           // Time Frame
                  echo    "&lt;td&gt;". $Unregisted."&lt;/td&gt;";                      // Pickup 
                  echo    "&lt;td&gt;". $Rego."&lt;/td&gt;";                           // Unregisted
                  echo    "&lt;td&gt;".$row["PickupLocation"] . "&lt;/td&gt;";        // Rego
                  echo    "&lt;td&gt;".$row["DropOffLocation"] . "&lt;/td&gt;&lt;/tr&gt;"; // Delivery
                  $i=$i+1;//Control Set
                  }
              echo'&lt;/tr&gt;';
  </code></pre>
  
  <p>I repeat this same output code for the results from the return booking.</p>
  
  <p>Is it possible to combine both queries into one so that the result set from both tables can be ordered by ASC and outputted by the above while statement.</p>