我有一個下表。如何找到鏈接的數據?
chained_schedule:
chained_id parent_schedule_id next_schedule_id
1 71 72
2 72 73
3 74 75
當我給作爲輸入parent_schedule_id=71
,輸出應該發現,特定的記錄,並通過其next_schedule_id
鑑定的記錄,而這又可以鏈接到其他記錄,...等等。
因此,對於上述數據和查詢,輸出應該是這樣的:
chained_id parent_schedule_id next_schedule_id
1 71 72
2 72 73
我怎樣才能做到這一點?
什麼?請詳細說明你在做什麼 –
你正在使用哪些DBMS? Postgres的?甲骨文? –
如果您給parent_schedule_id = 71,則只應選擇第一行。爲什麼第2行有parent_schedule_id 72? –