"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.
同じテーブル内での選択はどのように行われますか?