Closed MatiasManevi closed 6 years ago
Where you're doing this:
return connection.query('SELECT * FROM tickets WHERE sale_details_id='+sale_details[1].id).then(function(result){
sale_details[1]['tickets'] = [];
sale_details[1]['tickets'].push(result[0]);
});
Anything returned from the .then
is passed on to the chain where you're doing the console log. You're not returning anything so rows will be undefined.
Hi everyone. Im trying to chain a few sql's.
I have some relationships and i want them to be correctly expressed on my final json. But for some reason i can not get the row result from de promise. For example in this piece of code:
console.log(rows) always prints "undefined". What am I doing wrong.
This is my code: