是否可以在Access中创建递归查询? [英] Is it possible to create a recursive query in Access?

查看:165
本文介绍了是否可以在Access中创建递归查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个job

Id
ParentID
jobName
jobStatus

根ParentID为0.

The root ParentID is 0.

在Access中是否可以创建查询以查找给定job的根? 该数据库是没有链接表的MDB. Access版本是2003.job可以是多个级别的深层子级.

Is it possible in Access to create a query to find a root for a given job? The database is MDB with no linked tables. The Access version is 2003. A job can be several levels grand children deep.

推荐答案

不,不是.在SServer 2005之后的SQL Server中支持递归查询,但在Access中不支持递归查询.

No, It isn't. Recursive queries are supported in SQL Server after SServer 2005, but not in Access.

如果您事先知道级别数,则可以编写查询,但这不是递归查询.

If you know the number of levels beforehand, you could write a query, but it wouldn't be a recursive one.

在SQL Server中,为此使用了CTE(SQL扩展名):请参见

In SQL Server, CTE (An SQL extension) is used for that : see http://blog.crowe.co.nz/archive/2007/09/06/Microsoft-SQL-Server-2005---CTE-Example-of-a-simple.aspx

常规SQL不支持递归.

Regular SQL however does not have Recursivity support.

这篇关于是否可以在Access中创建递归查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆