我目前有这个代码:
\nEvento.findAll({\n where: db.sequelize.where(db.sequelize.fn('MONTH', db.sequelize.col('start_date')), req.body.month),\n order: ['start_date'],\n attributes: ['id', 'description', 'start_date', 'end_date', 'picture', 'status', 'place', 'text'],\n include: [{\n model: TypeEvent\n }]\n}).then(events => {\n if (events) {\n res.status(200).send({\n events\n });\n } else {\n res.status(400).send({\n message: "without events"\n });\n }\n});\nRun Code Online (Sandbox Code Playgroud)\n但我也需要咨询今年的事情,我不知道该怎么做,我已经尝试了所有方法,但我无法得到答案。
\n我想要的 SQL 查询:
\nSELECT .... FROM ... WHERE MONTH(start_date)=5 AND YEAR(start_date)=2021 ORDER BY ..\nRun Code Online (Sandbox Code Playgroud)\n请帮助我\xc2\xa1\xc2\xa1\xc2\xa1\xc2\xa1
\n