【发布时间】:2015-09-29 18:18:13
【问题描述】:
我有两张桌子。如何在 Sequelize 中将第一个表中的字段与第二个表中的 id 字段链接?示例:
第一个表:
id | author | text
1 | 2 | 'test1'
2 | 2 | 'test2'
3 | 1 | 'test3'
第二张桌子:
id | name
1 | John
2 | Jane
第一个表结果中的请求值应在author 字段中包含名称。示例:
first.findAll().then(function(result) {
console.log(result);
});
返回它:
id | author | text
1 | Jane | 'test1'
2 | Jane | 'test2'
3 | John | 'test3'
(抱歉英语不好)
【问题讨论】:
标签: database node.js sequelize.js