I’ve got a query that gets orders from my database.
Each order has ‘bought_products’ attached.
These products have an id.
Now I want to create the following filter:
- Show me all orders where product
71
is bought - Then, exclude orders where product s
71 && 72
have been bought
So effectively I’ll get a list of orders where ONLY 71 is bought, and 72 was NOT bought.
Here’s a visualisation:
How do I do this?
If I use the .where()
formatter to only include orders that have id 71
I’ll not know if that order also had bought product 72
.
I think I need the formatter “where does NOT contain”. But that doesn’t exist.
So then I think I need to use the .filter()
formatter and create my own filter, but not sure how to use it.
If it helps, here’s the db query:
Community Page
Last updated:
Last updated: