在 Sequelize 中,where column equal column in another table 怎么办?
how to do in Sequelize where column equal column in another table?
我正在将 Sequelize 与 nodeJS 一起使用,并且正在对 Sequelize 中的多个表进行内部联接,但是在 where 条件下我找不到添加条件的方法 where table1.columnX = table2.column
像这样:
where: {
'%included_table1.columnX%': Sequelize.col('column')
}
另外,您需要在include
选项中注明required: true
才能得到INNER JOIN
。
我正在将 Sequelize 与 nodeJS 一起使用,并且正在对 Sequelize 中的多个表进行内部联接,但是在 where 条件下我找不到添加条件的方法 where table1.columnX = table2.column
像这样:
where: {
'%included_table1.columnX%': Sequelize.col('column')
}
另外,您需要在include
选项中注明required: true
才能得到INNER JOIN
。