【发布时间】:2021-03-16 08:11:54
【问题描述】:
树:
id name
1 apple
2 aspen
树属性类别:
id categorie
1 leafColour
2 trunkColour
树属性:
id tree_id attribute tree_attribute_categorie_id
1 1 brown 1
2 1 brown 2
3 2 green 1
4 2 brown 2
sql 语句如何过滤如下(属性和 tree_attribute_categorie_id):
[[brown and 1] OR [red and 1]] AND [[brown and 2] OR [green and 2]] = return apple tree
[[brown and 1] OR [green and 1]] AND [[brown and 2] OR [green and 2]] = returns both trees
【问题讨论】:
标签: mysql sql inner-join aggregate-functions having-clause