Mysql 续集查询没有结果

Mysql 续集查询没有结果,mysql,node.js,sequelize.js,Mysql,Node.js,Sequelize.js,我正在尝试使用sequelize在NodeJS中进行costum查询 所以我有我的api调用: router.route('/api/divisionData/:division_id') .get(function (req, res) { var division = Division.build(); division.retrieveDataById(req.params.division_id, function (users) { if (users

我正在尝试使用sequelize在NodeJS中进行costum查询

所以我有我的api调用:

router.route('/api/divisionData/:division_id')
.get(function (req, res) {
    var division = Division.build();

    division.retrieveDataById(req.params.division_id, function (users) {
        if (users) {
            res.json(users);
        } else {
            res.status(401).send("Data not found");
        }
    }, function (error) {
        res.send("Data not found");
    });
});
然后我有了我的检索数据库ID:

sequelize.query("select division_id, (modules.user_id) as modules_taken, ROUND(avg(scores.score),2) as average_score from " +
                "user join " +
                "(select user_id, score from test_score " +
                "UNION ALL " +
                "select user_id, score from task_score WHERE status_id = 1 " +
                ") as scores " +
                "  on user.id = scores.user_id " +
                    "  join ( " +
                    "      SELECT user_id FROM test_score " +
                    "  UNION all " +
                    "  SELECT user_id FROM task_score WHERE status_id NOT IN (3) " +
                    "  UNION all " +
                    "  SELECT user_id FROM elearning_score " +
                    "  union all" +
                    "  SELECT user_id FROM academy_screening " +
                    "  union all" +
                    "  SELECT user_id FROM academy_evaluation " +
                    "  union all " +
                    "  select user_id FROM academy_survey " +
                    "  union al " +
                    "  select user_id FROM offline_score " +
"  ) as modules on user.id = modules.user_id WHERE division_id = " + user_id +"  group by division_id", {type: sequelize.QueryTypes.SELECT})
    .then(onSuccess).error(onError)
我已经在MySql中测试了这个查询,它运行良好,但是这个调用的返回结果是:

data not found

有人能告诉我我做错了什么吗?

不确定是否可能是输入错误,从academy\u survey+union al+中选择用户id,而不是union all,但是您不应该捕捉错误对象您使用的是哪个版本?您是否尝试过使用QueryTypes.RAW和使用。spread@JanAagaardMeier这给了我同样的结果,这意味着没有找到数据。您使用的是哪个sequelize版本?