app.post("/viewaverageresult", (req, res) => {
models.Tests.findAll({
attributes: [models.sequelize.fn('AVG',
models.sequelize.col('totalScore'))],
where: {fileName: req.body.averageScoreSingleTest}
}).then((results) => {
res.render("viewaverage", {averageScore: results})
})
})
该代码在语法上似乎是正确的,并表明它正在执行
SELECT AVG("totalScore") FROM "Tests" AS "Tests" WHERE "Tests"."fileName" = 'data/news.html';
这似乎都是正确的。但是结果是空的。
我丢失的数据在哪里?