Sequelize with NodeJS can't join tables with limit

前端 未结 3 1568
南笙
南笙 2021-01-08 01:00

I\'m trying to implement a simple query that should look like this:

select * from property join entity_area on property.id=entity_area.entity_id and entity_a         


        
3条回答
  •  星月不相逢
    2021-01-08 01:24

    I had this problem recently using sequelize 4.28.6, this is what worked for me

     User.findAll(
    {
      where: {
        $Tasks$: null,
      },
      include: [
        {
          model: Task,
          // required: false,
        },
      ],
      limit: 3,
      subQuery: false,
    })
    

    @yuriscom answer still works but, i didnt want to edit the sequelize codebase since the issue has been fixed and adding subQuery: false, works

提交回复
热议问题