title: How to get a string from query result in Nodejs
body: <p>My code is in Nodejs backend below</p>
  <pre><code>app.get('/room_selected', function (req, res){
      var clientID = 'a@gmail.com';
      var room = 'Room 1';
      var query = connection.query ('SELECT clientID FROM clientDevices WHERE deviceName = ?', [room], 
      function (err, rows, fields){
          if (err) throw err;
          return rows[0].clientID;
      });
      console.log (query);
      if (clientID == query){
          res.status(400).json ('success');
      } else {
          res.status(400).json('The selected room does not have a device attached');
  
         
      }
     
  });
  </code></pre>
  <p>When I print console.log(query), it returns [ { clientID: 'a@gmail.com' } ].</p>
  <p>I want to return only <strong>a@gmail.com</strong>. Could you guys know how to figure out it? since I want it to compare with clientID to print out the success message, however, it printed out The selected room does not have a device attached</p>
  <p>Please help. Thank you</p>