In node-socketchat system, i am using mysql module.
I wants to take data after checking through 4-5 tables, but cannot make a join statement.
suppose i need to take a friends collection and their details.
Now i am following below method.
var friends = new Array();
var connection = mysql.createConnection(database);
connection.query(sql, function(err, rows, fields) {
if (err) throw err;
for (var key in rows) {
friends.push(rows[key].friendid);
// Here i am expecting to write another sql statement
}
getfriendsdetails(friends)
connection.end();
})
function getfriendsdetails(friendslist){
connection = mysql.createConnection(database);
sql = 'select statment for taking friends details in in statement'
connection.query(sql, function(err, rows, fields) {
//storing each row detail in to an array
});
}
My Question is, can i call the details query inside first for loop ? is it possible ?