【发布时间】:2013-12-16 07:15:26
【问题描述】:
我有以下表格:
规格:
id | name
-----------
1 | hello
2 | world
3 | foo
4 | bar
属性:
name | value | specID
---------------------
status | finish | 1
parent | 2 | 1
status | work | 2
parent | 3 | 2
status | ... | 4
parent | 3 | 4
现在我想说:
列出 specID 3 下的所有规范。
我现在没有降级,但结果一定是:
id | name | parent
------------------
3 | foo | NULL
2 | world | 3
1 | hello | 2
4 | bar | 3
我如何在 mysql 中做到这一点?
【问题讨论】:
标签: mysql sql select join left-join