1

我的桌子在我的 ma 访问权限中在此处输入图像描述

我正在使用查询从 sql 数据库中检索数据

SELECT TOP (100) PERCENT
     dbo.Tree.pname
    ,dbo.Tree.SlNo AS PNum
    ,dbo.Tree.pname AS CName
    ,dbo.Tree.Prnt
FROM dbo.Tree
LEFT OUTER JOIN dbo.Tree AS Ptr_AcntInfo_1 ON dbo.Tree.Prnt = Tree.SlNo
WHERE Tree.Ref = 155
ORDER BY dbo.Tree.Prnt;

当我从 sql 数据库中检索时,它运行良好(MS Access 和 SQL 数据库中的表结构相同)。

当我使用相同的查询从 MS Access 数据库中检索数据时,它显示错误为The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

我想要来自 MS Access 数据库的相同查询。帮我。谢谢你。

4

1 回答 1

1

试试这个(TOP (100) PERCENT我认为也LEFT JOIN没有必要)-

SELECT
      t.pname
    , t.SlNo AS PNum
    , t.pname AS CName
    , t.Prnt
FROM Tree AS t
--LEFT OUTER JOIN Tree AS t2 ON t.Prnt = t2.SlNo
WHERE t.Ref = 155
ORDER BY t.Prnt
于 2013-07-18T05:35:34.950 回答