A
A
asergrisa2018-05-21 02:34:37
MySQL
asergrisa, 2018-05-21 02:34:37

How to get a sample without the results of another sample?

I have Sequelize models

  • `User` with `name` fields
  • `Book` with `bookName` fields
  • `Own`
  • `Read`

The `User` model is related to `Book` via `Own` as M<->M , this is how I store users and their books.
The `User` model is linked to `Book` via `Read` as M<->M so I store users and the books they have read, not necessarily my own.
How can I get a list of books that the user has, but he has not read them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2018-05-21
@BorisKorobkov

If in SQL, then ... LEFT JOIN... WHERE ... IS NULL(ORM does not allow doing this - maximum on QueryBuilder).
If in PL, then by brute force
with verification

he did not read them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question