Answer the question
In order to leave comments, you need to log in
How to select with condition AND on the field of the connected 1-n table in SQL?
There are two tables: entity and entity properties.
Сущность:
Название | ID
Свойства:
ID сущности | свойство
Answer the question
In order to leave comments, you need to log in
He himself invented such a bicycle (which later he made even shorter. See in the comment):
SELECT *
FROM "сущность"
WHERE
(
SELECT COUNT(*) FROM "свойства" WHERE "свойства"."ID сущности" = "сущность"."ID" AND
(
свойство = '1' OR
свойство = '2'
)
) = 2 --тут количество свойств на которые накладываются условия!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question