Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用于在文档管理系统中保存“文件夹”的表格。下面给出的表格结构
folder_id name parent_id
这parent_id是同一表指向其父文件夹的参考键。所以我需要从文件夹 id 中检索所有文件夹 id。即,文件夹的子文件夹列表。
parent_id
是否可以将单个查询作为自连接进行?
尝试
Select d.folder_id from folders as d, folders as e where d.parent_id = e.folder_id