无法表达连接表达式

时间:2015-04-28 13:04:52

标签: sql ms-access join syntax-error

我在SO上发现了一个类似的问题,但解决方案说要删除一组额外的括号。我这样做了,但它在查询表达式"中给了我一个新的错误 - "语法错误(缺少运算符)。我没有看到另外一组括号,除了我在下面用星号注意到的那套之外我还可以删除。 (我专注于解决方案说明设置括号)的事实。现在我只是删除越来越多的括号,希望我偶然发现哪个集合导致问题。有什么想法吗?

编辑整个错误消息是" Microsoft Access无法在设计视图中表示连接表达式dbo_jobmatl.suffix = dbo_job.suffix。& #34; "可能已删除或重命名了一个或多个字段;在连接表达式中指定的一个或多个字段或表的名称可能拼写错误;联接可以使用“设计”视图中不支持的运算符,例如>或<。"

 SELECT dbo_jobmatl.item, dbo_job.whse
FROM **(**(dbo_job INNER JOIN dbo_jobmatl ON (dbo_jobmatl.suffix = dbo_job.suffix) AND (dbo_job.job = dbo_jobmatl.job)**)** INNER JOIN dbo_ISW_LPLot ON dbo_jobmatl.item = dbo_ISW_LPLot.item) INNER JOIN (dbo_location INNER JOIN dbo_ISW_LP ON dbo_location.loc = dbo_ISW_LP.loc) ON dbo_job.whse = dbo_ISW_LP.whse
GROUP BY dbo_job.job, dbo_job.suffix, dbo_job.item, dbo_job.job_date, dbo_jobmatl.item, dbo_job.whse, [qty_released]*[matl_qty], dbo_jobmatl.qty_issued, ([qty_released]*[matl_qty])-[qty_issued]
HAVING (((dbo_job.job) Not Like "BM*" And (dbo_job.job) Not Like "QCBEN*" And (dbo_job.job) Not Like "QCBRU*" And (dbo_job.job) Not Like "QCKIR*" And (dbo_job.job) Not Like "SS*" And (dbo_job.job) Not Like "SU*" And (dbo_job.job) Not Like "TR*" And (dbo_job.job) Not Like "WC*" And (dbo_job.job) Not Like "WH*" And (dbo_job.job) Not Like "WT*" And (dbo_job.job) Not Like "KR*" And (dbo_job.job) Not Like "HR*") And ((dbo_job.item) Not Like "Indirect") And ((dbo_job.job_date)=Forms!MainForm!Text0));

1 个答案:

答案 0 :(得分:0)

试试这个:

SELECT 
    dbo_jobmatl.item
    , dbo_job.whse
FROM 
    dbo_job 
    INNER JOIN dbo_jobmatl ON (dbo_jobmatl.suffix = dbo_job.suffix) AND (dbo_job.job = dbo_jobmatl.job) 
    INNER JOIN dbo_ISW_LPLot ON dbo_jobmatl.item = dbo_ISW_LPLot.item 
    INNER JOIN (dbo_location ON dbo_location.loc = dbo_ISW_LP.loc)
    INNER JOIN dbo_ISW_LP ON dbo_job.whse = dbo_ISW_LP.whse
GROUP BY 
    dbo_job.job, dbo_job.suffix, dbo_job.item, dbo_job.job_date, dbo_jobmatl.item, dbo_job.whse, [qty_released]*[matl_qty], dbo_jobmatl.qty_issued, ([qty_released]*[matl_qty])-[qty_issued]
HAVING 
    (((dbo_job.job) Not Like "BM*" And (dbo_job.job) Not Like "QCBEN*" And (dbo_job.job) Not Like "QCBRU*" And (dbo_job.job) Not Like "QCKIR*" And (dbo_job.job) Not Like "SS*" And (dbo_job.job) Not Like "SU*" And (dbo_job.job) Not Like "TR*" And (dbo_job.job) Not Like "WC*" And (dbo_job.job) Not Like "WH*" And (dbo_job.job) Not Like "WT*" And (dbo_job.job) Not Like "KR*" And (dbo_job.job) Not Like "HR*") And ((dbo_job.item) Not Like "Indirect") And ((dbo_job.job_date)=Forms!MainForm!Text0));

我将您的查询文本粘贴到gedit中,将语法高亮显示设置为SQL,然后开始格式化它。这让我看到dbo_location的一些连接语法混合到了dbo_ISQ_LP的连接语法中。我没有查看你的HAVING语法。