选择附近的语法不正确

时间:2014-12-30 06:32:21

标签: sql

SELECT DISTINCT
       c.AUF_NR AS JPO,
       c.KUNR AS CustNo,
       c.BESTELL_NR AS CustJPO,
       c.KOPF_PROJEKT AS Project,
       c.ERFASS_DAT AS OrdDate,
       c.LIEFER_DAT AS DlvDate

FROM OPENQUERY (server,'
     server.AUF_STAT a,
     server.AUF_POS b,
     server.AUF_KOPF c
WHERE 
      c.AUF_NR = 140281')

2 个答案:

答案 0 :(得分:1)

您尝试传递给server的查询未完成。它必须是一个正确的SQL查询,而不仅仅是最后一点。

答案 1 :(得分:1)

你可以写成:

SELECT  * 
FROM OPENQUERY (server,' select DISTINCT   c.AUF_NR AS JPO,
                                c.KUNR AS CustNo,
                                c.BESTELL_NR AS CustJPO,
                                c.KOPF_PROJEKT AS Project,
                                c.ERFASS_DAT AS OrdDate,
                                c.LIEFER_DAT AS DlvDate
                        from 
                                --server.AUF_STAT a,
                                --server.AUF_POS b,
                                server.AUF_KOPF c
                        WHERE 
                                c.AUF_NR = 140281')