title: Combine output of 2 queries in REST API
body: <p>I am using node.js restify module. I have a REST API which outputs the result of a single MySQL query in json. Here is the code of the API;</p>
  
  <pre><code>var rest_api_get_list = function (app, url_name) {
      function respond(req, res, next) {
          var door_mac = req.query.door_mac;
  
          var connection = own_mysql.getMySQL_connection();
  
          var query_str =
                  "SELECT doors.mac_addr, " +
                  "sensors.sensor_type " +
                  "FROM sensors " +
                  "WHERE (doors.mac_addr = ?) "
              ;
  
          var query_var = [door_mac];
  
          var query = connection.query(query_str, query_var, function (err, rows, fields) {
              //if (err) throw err;
              if (err) {
                  //throw err;
                  console.log(err);
                  logger.info(err);
              }
              else {
                  res.send(rows);
              }
          }); 
          return next();
      }
  
      app.get(url_name, respond);
  };
  </code></pre>
  
  <p>Suppose I have another query which looks something like this;</p>
  
  <pre><code>    var query_str_2 =
              "SELECT knobs.mac_addr, " +
              "furniture.furniture_type " +
              "FROM furnitures" +
              "WHERE (knobs.mac_addr = ?) "
          ;
  </code></pre>
  
  <p>I want to combine the output of the 2 MySQL queries <code>query_str</code> and <code>query_str_2</code> and have the REST API return the result in json. How can this be done? </p>
  
  <p>To be clearer, I am thinking of the code doing something like this;</p>
  
  <pre><code>var rest_api_get_list = function (app, url_name) {
      function respond(req, res, next) {
          var door_mac = req.query.door_mac;
  
          var connection = own_mysql.getMySQL_connection();
  
          var query_str =
                  "SELECT doors.mac_addr, " +
                  "sensors.sensor_type " +
                  "FROM sensors " +
                  "WHERE (doors.mac_addr = ?) "
              ;
  
          var query_var = [door_mac];
  
          var query = connection.query(query_str, query_var, function (err, rows_output_1, fields) {
              //if (err) throw err;
          }); 
  
          var query_str_2 =
              "SELECT knobs.mac_addr, " +
              "furniture.furniture_type " +
              "FROM furnitures" +
              "WHERE (knobs.mac_addr = ?) "
          ;
  
          var query_2 = connection.query(query_str_2, query_var, function (err, rows_output_2, fields) {
              //if (err) throw err;
  
          }); 
  
          //How to display json output of rows_output_1 and rows_output_2?
  
          return next();
      }
  
      app.get(url_name, respond);
  };
  </code></pre>
  
  <p>EDIT: I started a bounty to attract answers which use Promises. </p>