Javascript 在sequelize的同一查询中,基于courseId获取多个不同计数的数据
目前我正在做如下事情Javascript 在sequelize的同一查询中,基于courseId获取多个不同计数的数据,javascript,mysql,node.js,sequelize.js,Javascript,Mysql,Node.js,Sequelize.js,目前我正在做如下事情 const [course1, course2, course3] = await Promise.all([ Classes.findAll({ where: { courseId: 1 }, count: 3 }), Classes.findAll({ where: { courseId: 2 }, count: 1 }), Classes.findAll({ where: { courseId: 3 }, c
const [course1, course2, course3] = await Promise.all([
Classes.findAll({ where: { courseId: 1 }, count: 3 }),
Classes.findAll({ where: { courseId: 2 }, count: 1 }),
Classes.findAll({ where: { courseId: 3 }, count: 5 }),
])
我想要的是,使用不同的where子句和count在单个查询中获取数据。
有没有更好的办法?还是其他方法