I have a Request table that has some columns. I need to select a row in the table and then use a specific column value(say request_initiator) to search it in another table.
connection.query('SELECT * FROM Requests WHERE `request_id` = ?', req.body.id, function(error,results, fields){}
My results gives me multiple objects which then contains the component elements with different value.
0
request_id 1
user_id "user1"
from "[email protected]"
to "owner2"
status "deleted"
1
request_id 2
user_id "user4"
from "[email protected]"
to "owner2"
status "pending"
I have to access results to get from and then search it in Owners table.
However, results.from doesn't give anything. results[0] gives the first object but I can't access the elements of that list
How should I proceed with this?
results[0].from?console.log(JSON.stringify(results[0]))results[0].fromshould've worked. May beconsole.log(results[0]["from"])