如何在续集查询中使用LIKE运算符?

时间:2019-05-27 14:42:49

标签: sequelize.js

在没有咨询的情况下进行Estoy庄园将utilizando sequelize.query()进行续集。科莫波多黎各人像歌剧院一样喜欢单身男女的狂欢

sequelize.query('(..) WHERE LOWER(u.NOMBRE) LIKE "LOWER(:find)%" AND u.ACTIVO = 1 ', {replacements: {find: req.params.usuario, id: req.session.passport.user}, type: sequelize.QueryTypes.SELECT})

1 个答案:

答案 0 :(得分:0)

根据您的问题如何使用$ like的示例:

const Sequelize = require('sequelize');
const Op = Sequelize.Op;

const user = User.findAll({ // or User.findOne
    where: {
        activo: 1, // your search condition
        [Op.like]: [
            { nombre: req.params.nombre } // your $like params
        ],
    }
    attributes: ['id', 'nombre'] // results you want returned
})