Query changing Join - Sequelizejs

Asked

Viewed 101 times

1

How could you do this query using Sequelize?

SELECT t1.* FROM Table1 t1 inner join Table2 t2 on t1.id != t2.t1_id

1 answer

0


You can make a raw query and keep that SQL you already have. According to documentation you can do that with sequelize.query:

sequelize.query("SELECT t1.* FROM Table1 t1 inner join Table2 t2 on t1.id != t2.t1_id", { type: sequelize.QueryTypes.SELECT})
  .then(function(results) {
    // aqui podes usar o results
  })

Browser other questions tagged

You are not signed in. Login or sign up in order to post.