Looking for a way to filter clothes
based on their labels
, the labels
need to be considered for their classifications, such that different classification all needs to be satisfied (AND), same classification is joined (OR).
E.g. The following expectation can be satisfied:
Ask: (Blue(classification: Color)
or Green(classification: Color)
) and On Sale(classification: Discount)
or
Ask: Blue(classification: Color)
and (Aloha(classification: Style)
or Knit(classification: Style)
)
Need help understand the best way to achieve this.
SELECT"clothes".*FROM"clothes"INNER JOIN "clothes_labels" ON"clothes_labels"."clothes_id" = "clothes"."id"INNER JOIN "labels" ON"labels"."id" = "clothes_labels"."tag_id"WHERE ...