Sequelize模糊查询

时间:2019-11-02 20:31:51   收藏:0   阅读:376

 

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

User.findAll({
 raw: true,
  order: [
      [name, DESC]
  ],  // 排序
  where: {
    // name: ‘cheny‘, // 精确查询
    mobile_no: {
      // 模糊查询
      [Op.like]:% +mobile_no + %
    }
  },
  attributes:[id,name], // 控制查询字段
})

 

 

 

.

原文:https://www.cnblogs.com/xiangsj/p/11783666.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!