I want to execute a query in a forEach or map but I am not getting any data.
Database used is PostgreSQL.
I'm using pg to connect to the database.
const tables = ["api","users","countries","phone_number","profile_photo","role",];
let data = [];
tables.forEach(async (ele) => {
let q = `select * from ${ele} ;`;
let qd = await pool.query(q);
data.push(qd);
});
res.json(data);