Use Sequlize model inside the [Op.notIn] #13213
Unanswered
rishat5081
asked this question in
Help & Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am facing the issue to fulfill the following mysql query using the sequelize modal, i have tried the modal too both are here
I want this query using the ORM
select list_name from lists l where l.list_id not in (SELECT sub.list_id from list_sub_activities sub left join. Activities a on a.list_act_id = sub.list_act_id where a.agency_id = 2)
-- List of Package ---> lists
The ORM is ::
List_of_Packages.findAll({ attributes: ['list_name'], where: { list_id: { [Op.notIn]: [List_sub_Activities.findOne({ attributes: ['list_id'], include: { model: Activities, attributes: ['agency_id'], required: false, where: { agency_id: 2 } } }) ] } } }) .then((response) => { for (const iterator of response) { console.log(iterator.list_name); } // console.log(response); })
Beta Was this translation helpful? Give feedback.
All reactions