SELECT *
FROM item_master
WHERE project_id IN (SELECT id FROM project_master
WHERE workspace_id in (SELECT id FROM workspace_master
WHERE company_id = 4));
How can I do this mysql query in sequelize – node js without using raw query?
2
Answers
This is working as I want.
If your model structure is like
item_master
has manyproject_master
, andproject_master
has manyworkspace_master
, then the following sequelize query will be applied withasync/await
.As I edited my answer. As you said in comment, you have model structure like workspace has many projects and projects has many items. Then Sequelize query will be like:
Now try this, I hope this will solve your issue.