1

I need to find the data using same field on mysql, but different values. but i geetting empty values in response.

I tried the $and condition to find the data on sequelize. but it getting not data in response.

 exports.multibranchdata = (req, res) => {

 const wherequery = { 
             $and: [{ id: { eq: 1 } },
                    { id: { eq: 2 } }
                   ] };
 branch.findAll(wherequery)

.then(data => res.status(200).send(data))

.catch(Sequelize.ValidationError, err => 
 res.status(422).send(err.errors[0].message))

.catch(err => res.status(400).send(err.message));
 };

1 Answer 1

1

Try OR query :-

 const wherequery = { 
             $or: [{ id: { eq: 1 } },
                    { id: { eq: 2 } }
                   ] };
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.