I was working in on Express.js with mysql. I need the json result from mysql query to be return value of the function.
intelligenceTopic()
function intelligenceTopic() {
let query = 'SELECT I.intelligence_type,T.topic,T.topic_code FROM topic T INNER JOIN intelligence I ON T.intelligence_id=I.id GROUP BY T.topic_code;';
var intelligence;
database.query(query, (err, result) => {
if (err) throw err;
intelligence = result;
});
return intelligence;
}