Answer the question
In order to leave comments, you need to log in
How to get data from 2 rows selectively with one request?
Suppose there is a Rules table
ID | Rule | ItemID | Access
1 | books | 0 | 1
2 | books | 1 | 0
3 | shelves | 0 | 1
SELECT * FROM books WHERE exists(
SELECT 1 FROM rules WHERE rule = 'books' AND itemid = books.id AND access = 1
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question