0
はsequelizeのORMでこのクエリsequelizeで列名の表を結合するにはどうすればいいですか?
select table2.node_id as id, table2.client_id as clientId, table1.collection_id as collectionId from table1 inner join table2 on table2.primary_collection_id = table1.collection_id
を再現するすべての可能な方法はありますか?
私はhasOne
とbelongsTo
関係を定義し、そうしようとした:
return Models.FileModel.findAll({
include: [
{ model: Models.NodeModel, required: true}
]
});
しかし、私はinner join
条件間違っている: inner join table2 on table2.node_id = table1.collection_d
が時々必要、まあtable2.primary_collection_id
Plsのは、あなたがテーブル間のリレーションシップを設定するコードを含んで私の作品
targetKey
を探していました。 – Shadow