Query changing join - SequelizeJS

1

How could I do this query using Sequelize?

SELECT t1.* FROM Table1 t1 inner join Table2 t2 on t1.id != t2.t1_id
    
asked by anonymous 02.08.2016 / 02:27

1 answer

0

You can do a raw query and keep this SQL you already have. According to documentation you can do this 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
  })
    
02.08.2016 / 09:51