"id" "parent" "name"
"1" "0" "Books"
"2" "1" "Crime Fiction"
"3" "2" "Death On the Nile"
从类似上面的内容中,我如何选择name
父行的名称以及child
. 在这里,将提供子行的名称。我需要得到name
父母的。
期望的输出:
@id = 3
Crime Fiction //This is the name of the parent row - in this case 2
Death on the Nile // This is the name of the row who's id was supplied.
如何在同一张表中进行选择?