这样的内部联接怎么可以转换成Sequelize?

时间:2018-03-06 03:07:50

标签: sql node.js postgresql sequelize.js

我主要是想看看你将如何在这里进行内部联接。

    SELECT * From "Users" as biz
INNER JOIN "Deals" as d
        ON biz.id = d."UserId" 
     WHERE (biz.latitude BETWEEN 18 AND 21) 
       AND (biz.longitude BETWEEN -78 AND -73);

这是我从文档中得到的......但不确定如何继续进行

Deals.find({ where: { }, include: [User]})

1 个答案:

答案 0 :(得分:0)

inner join required : true所需要的只是Deals.find({ where: { }, include: [{ model : User , required : true // This will make your inner join }]})

findAll
  

注意:使用findOnefind代替{{1}}