title: How can I bind a variable to sequelize literal?
body: <p>I have this subquery that is used to check the existence of a column related to the source model.</p>
  
  <pre><code>const defaultingLoans = await Loan.findAll({
      where: {
        [Op.and]: database.sequelize.literal('EXISTS(SELECT * FROM "Instalments" WHERE "Instalments"."loanId" = "Loan"."id" AND "Instalments"."status" = 'pending')')
      }
    });
  </code></pre>
  
  <p>The query works fine but the value <code>pending</code> ideally won't be fixed so I'll like to have a variable there that can be used to query for different status.</p>
  
  <p>How can I replace the pending string with a variable. </p>
  
  <p>Concatenation didn't work here because Sequelize has a weird way of parsing concatenated SQL queries which result in an error. An example is here <a href="https://pastebin.com/u8tr4Xbt" rel="noreferrer">https://pastebin.com/u8tr4Xbt</a> and I took a screenshot of the error <a href="https://imagebin.ca/v/4RbsQOAPaxvO" rel="noreferrer">here</a></p>