How can I create a sql query involving a WHERE NOT LIKE
clause using Sequelize.js(Version 1.7.0)? The final SQL query should look like this
SELECT * FROM transfers
WHERE address
NOT LIKE '%bank%'
This is the code that I have
findToProcess: function(callback) {
var query;
query = {
where: {
status: 1
address: 'Bank Address',
},
order: [["created_at", "ASC"]]
};
return Transfer.findAll(query).complete(callback);
Squelize version 2, such a query can be made using $notLike: '%hat'
operator. Sadly I can't update my sequelize version. Is there any way to get this done using sequelize v1.7.0?
Sequelize Query We have achive to follow sequelize document use given examples
const { Op } = require("sequelize");
where: { status: 1,
address: {
[Op.like]: '%hat', // LIKE '%hat'
[Op.notLike]: '%hat'// NOT LIKE '%hat'
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.