title: Calculated Fields with nestTables Option for MySQL Query in NodeJS
body: <p>I'm using the 'nestTables' option in the code below to separate the data returned from an SQL query into their respective tables.  I am also including a calculated field in my query that I would like to include in the primary table.  </p>
  
  <p>As an example, I am executing the following route:</p>
  
  <pre><code>router.route('/person/:personId').get(function(req,res){
      var person_id = req.params.personId;
      db.getConnection(function(err, connection) {
          if (err) {
              return res.status(503).send({ result: false, error: 'CONNECTION error: ' + err.code});
          } else {
              var sqlString='SELECT *, someField - 1 as calculated FROM person LEFT JOIN person_status ON person.id = person_status.person_id WHERE person.id = ' + person_id;
              var options={sql:sqlString,nestTables:true};
              connection.query(options, function(error, rows, fields) {
                  connection.release();
  
                  var nestingOptions = [
                      {tableName: 'person', pkey:'id'},
                      {tableName: 'person_status', pkey:'id', fkeys:[{table:'person',col:'person_id'}]}
                  ];
  
                  if (error) {
                      return res.status(500).send({ result: false, error: 'QUERY ERROR: ' + error.code});
                  } else {
                      return res.status(200).send(rows);                 
                  }
              });
          }
      });
  });
  </code></pre>
  
  <p>and I am receiving the following JSON Response:</p>
  
  <pre><code>[
    {
      "person": {
        "id": 1,
        other person data . . . 
        "person_status": [
          {
            "id": 3,
            other data . . . 
          }
        ]
      },
      "person_status": {
        "id": 3,
        other data . . . 
      },
      "": {
        "calculated": 0
      }
    }
  ]
  </code></pre>
  
  <p>Ideally, I would like to include the calculated field into the person subgroup as shown below:</p>
  
  <pre><code>[
    {
      "person": {
        "id": 1,
        "calculated": 0
        other person data . . . 
        "person_status": [
          {
            "id": 3,
            other data . . . 
          }
        ]
      },
      "person_status": {
        "id": 3,
        other data . . . 
      }
    }
  ]
  </code></pre>
  
  <p>Is there any way that I can include the calculated field into the person table,  or is there a better solution that fits this problem?</p>
  
  <p>Thanks in advance!</p>