title: How to join twice a single table in sequelize using following and followers example
body: <p>This code is running perfectly. i can get following and followers now i need to see that followers that i am getting is i am also following them ?</p>
  
  <p>This is the question that how can i make another query/subQuery to Followers table and see that i am also following to my followers.</p>
  
  <p>Follower Table</p>
  
  <pre><code>export default function(sequelize, DataTypes) {
    return sequelize.define('Follower', {
      _id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
      },
      userId: {
        type: DataTypes.INTEGER,
        allowNull: false
      },
      followingId: {
        type: DataTypes.INTEGER,
        allowNull: false
      }
    });
  }
  </code></pre>
  
  <p>Association</p>
  
  <pre><code>db.Follower.belongsTo(db.User, {as:'following', foreignKey: 'followingId'});
  db.Follower.belongsTo(db.User, {as:'follower', foreignKey: 'userId'});
  </code></pre>
  
  <p>Query</p>
  
  <pre><code>Follower.findAll({
          where: {
              followingId: userId
          },
          attributes: ['_id'],
          include: [
            {
              model: User,
              attributes: ['fullName', 'username', '_id', 'picture'],
              as: 'follower'
            }
          ]
      })
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have achieve desired result form row query :</p>
  
  <pre><code>SELECT  F.userId, F.`followingId` , F1.`followingId` as IsFollowing , U.`fullName` FROM Followers as F
  
  INNER JOIN Users as U ON userId = U._id
  
  LEFT JOIN Followers as F1 On F.userId = F1.followingId
  
  WHERE F.followingId = 142 
  </code></pre>
  
  <p>Still struggling in sequelize.</p>