Query parameter substitution: There are two ways to replace query parameters in the original query, in the form of parameters starting with : or with ? replace.
sequelize.query('select * from projects where status = ?', {
replacements : ['active'],//按顺序传入需要替换?的值
type : Sequelize.QueryTypes.SELECT //指定查询类型
}).then(function(projects){
//返回查询结果
console.log(projects);
})
sequelize.query('select * from projects where status = :status', {
replacements : {
status : 'active' //按:后的标识名传入其替换成的值
},
type : Sequelize.QueryTypes.SELECT //指定查询类型
}).then(function(projects){
//返回查询结果
console.log(projeccts);
})