本文介绍了Access 2010:查询表达式中的语法错误(缺少运算符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的sql查询中包含三个表,但收到一条错误消息.

I want to have three tables in my sql query but I get an error message.

我有以下sql代码:

 SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance, 
 drugs.strength, drugs.strength_type, drugs.dosage_form, drugs.minimum_quantity, 
 SUM(warehouse.in_quant)+SUM(pharmacy.in_quant)-SUM(warehouse.out_quant)-
 SUM(pharmacy.out_quant) AS Total_available_stock

 FROM drugs as a 
  INNER JOIN warehouse as b
    ON a.ID = b.drug_id 
  INNER JOIN pharmacy as c 
    ON b.drug_id = c.drug_id
 GROUP BY warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance, 
 drugs.strength, drugs.strength_type, drugs.dosage_form, drugs.minimum_quantity;

我得到了错误:

 Syntax error (missing operator) in query expression in 'a.ID = b.drug_id 
 INNER JOIN pharmacy as c
     on b.drug_id = c.drug_i'.

请帮忙吗?

推荐答案

在Access中,如果有多个连接,则需要括号:

In Access you need parentheses when you have more than one join:

FROM (drugs as a 
  INNER JOIN warehouse as b
    ON a.ID = b.drug_id) 
  INNER JOIN pharmacy as c 
    ON b.drug_id = c.drug_id

这篇关于Access 2010:查询表达式中的语法错误(缺少运算符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 06:50