Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
访问递归SQL?_Sql_Ms Access_Union - Fatal编程技术网

访问递归SQL?

访问递归SQL?,sql,ms-access,union,Sql,Ms Access,Union,我有一个给定的MS Access数据库,其中有一个表: ID, Name, Chief 1, Max, NULL 2, Meier, Max 3, Maier, Meier 4, Mueller, Meier 5, Schmitz, Max .... 现在,我想进行一次选择,以获得其层次结构中所有人员的列表: Max => Meier => Maier Max => Meier => Mueller Max => Schmitz 使用SQL和UNION可以做到这

我有一个给定的MS Access数据库,其中有一个表:

ID, Name, Chief
1, Max, NULL
2, Meier, Max
3, Maier, Meier
4, Mueller, Meier
5, Schmitz, Max
....
现在,我想进行一次选择,以获得其层次结构中所有人员的列表:

Max => Meier => Maier
Max => Meier => Mueller
Max => Schmitz
使用SQL和UNION可以做到这一点吗?我该怎么做

谢谢大家!

不在Access SQL中

但是,对于一个固定的计数,比如说,六层的深度,您可以使用一个查询和子查询以及子查询。。。等,如果你有一个有限的水平计数