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://github.com/demopark/sequelize-docs-Zh-CN

https://segmentfault.com/a/1190000011583806

 

https://blog.csdn.net/qq_30101131/article/details/79474905 

 

 

.

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2021-12-10
  • 2021-07-22
  • 2021-08-23
猜你喜欢
  • 2022-12-23
  • 2021-04-13
相关资源
相似解决方案