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

查看:37
本文介绍了是否可以在 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 扩展)用于此目的:参见 http://blog.crowe.co.nz/archive/2007/09/06/Microsoft-SQL-Server-2005---CTE-Example-of-a-simple.aspx

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天全站免登陆