Sequelize其中和和

问题描述 投票:0回答:2

我有一系列的ID。 我需要在这个名称等于'red'的集合中获取行

就像是 : whereIn('id',[1,2,3]) andWhere (name='red') 提前致谢。

mysql sequelize.js
2个回答
0
投票

试试这个

Table_Name.findAll({
      where: {
        id: {$in: [1, 2, 3]},
        name: 'red'
      }
    })

0
投票

在mysql中使用:

select *from table_name where id in (your_array) and name = 'red';

您可以使用js代码传递数组。

© www.soinside.com 2019 - 2024. All rights reserved.