I'm getting [ { 'AVG(Price)': '31000.0000' } ] instead of '31000.0000
this is the function
async function getAveragePrice(year) {
const sql = await init();
const [rows] = await sql.query('SELECT AVG(Price) FROM Car where year=
?', [year], (err, result) => {
if (err) {
return null;
}
});
return rows;
}
I'm using nodejs mysql2