Sequelize concat in where子句?

时间:2016-05-14 23:30:21

标签: javascript sequelize.js

我正试图在sequelize

中这样做
SELECT * FROM tbl_person as p,tbl_employee as e
WHERE CONCAT(p.first_name,' ',last_name) = full_name;

如何在sequelize javascript中转换它?

提前谢谢。

1 个答案:

答案 0 :(得分:1)

我之前从未使用过sequelize,但是在浏览了一下文档之后,你还不能使用Model.findAll({ where: Sequelize.where( Sequelize.fn("CONCAT", Sequelize.col("first_name"), " ", Sequelize.col("last_name") ), { eq: Sequelize.col('full_name') } ) }); 吗?

if (Meteor.users.find().count() === 0) {
  seedUserId = Accounts.createUser({
    email: 'f@oo.com',
    password: '123456'
  });
}