A
A
Alexey Cherepanov2017-01-23 08:47:53
Database
Alexey Cherepanov, 2017-01-23 08:47:53

How to make a common where for the records of the requested table and the records of the included include table?

I am using sequelize ORM. I make a query to the table of orders, include goods in it, how can I do this: "WHERE orders.number = 1 OR goods.vencode = 1; ?
I know how to use $or, but where related to the goods is written in include, and where for orders after include, but how to write a general where?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cherepanov, 2017-01-23
@Udjine

Handled the situation

$or:[
  '$goods.vencode$': {
    $like: '%searchstring%'
  },
  number: { 
    $like: '%searchstring%'
  }
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question