U
U
urajo2019-11-25 10:03:52
Node.js
urajo, 2019-11-25 10:03:52

How to find a query in the database, one-to-many for several conditions?

otd.findOne({where:{name: ot.name}})
              .then(otdsu=>{
                if(!otdsu) return;
                otdsu.getSubOtds()
                .then(subOtds=>{
                  for(sub of subOtds){
                    console.log(sub.name);
                  }
                })
                .catch();
              })
              .catch();

In this part, a request is made to the database, in ot.name Administrative services. Administrative services have otdid = 2, i.e. now all results with this id are displayed from the common database, I need the query to look for another match in the pnd column. If you just add a comma to the request, it will not work, because I understand that it is not just looking in the linking database. How to be?
5ddb7c391230d695132710.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question