【发布时间】:2013-11-15 03:31:58
【问题描述】:
我的数据库包含几个查找表(在 UI 表单上显示为下拉菜单)。
例如,
customer_data - 客户人口统计信息。
lookup_car - 存储汽车描述(Pinto、Vega、Reliant Robin、Mustang、Corvette)
junction_car_customer - 加入拥有一辆或多辆汽车的客户
客户 Jeremy Clarkson (cust_id: 1) 拥有三辆汽车。他的记录下拉菜单显示:
Pinto (car_id=100)
Reliant Robin (car_id=101)
Vega (car_id=102)
junction_car_customer 数据如下所示:
cust_id car_id
1 100
1 101
1 102
我正在尝试返回显示客户名称和拥有的模型的行。
这是我的查询:
SELECT
cd.cust_id,
cd.name_first,
cd.name_last,
jcc.car_id,
lc.car_desc
FROM
customer_data AS cd
LEFT JOIN ju_cust_car AS jcc ON jcc.cust_id = cd.cust_id
LEFT JOIN lookup_cars AS lc ON lc.car_id = jcc.car_id
ORDER BY
cd.name_last
我得到:
查询表达式 'jcc.cust_id = 中的语法错误(缺少运算符) cd.cust_id LEFT JOIN lookup_cars AS lc ON lc.car_id = jcc.car_id'
是什么导致了这个错误?
【问题讨论】:
-
@Deepshikha:上面的查询可能看起来不错,但在 Access 中不起作用。
标签: sql ms-access select join syntax-error