问题
I'm trying to search for the following condition in a merged table between two tables.
It should collect and return records that has the buyer 'alex' or seller 'alex'.
The buyer exists in Chat table and seller exists in Market table which I have included as shown below. However, I am unable to get it to work. Any ideas are welcome.
Chat.findAll({
        where: {
           buyer: 'alex',
               seller: 'alex'
          },
        include: [{
          model: Market,
          required: true
         }]
      })
    回答1:
The seller has to be inside Market 
Chat.findAll({
        where: {
           buyer: 'alex',
          },
        include: [{
          model: Market,
          required: true,
          where: {
            seller: 'alex'
          }
        }]
      })
    来源:https://stackoverflow.com/questions/51000931/node-js-sequelize-findall-column-of-included-table-model