MS Access 查询问题
SELECT
tbl_vehicle_models.model_name AS Vehicle_Model,
tbl_vehicle_models.manufacturer AS Manufacturer,
tbl_jobs.vehicle_registration_number AS Registration_Number,
tbl_customers.first_name + " " + tbl_customers.last_name AS Customer_Name,
tbl_customers.address AS Address,
tbl_customers.contact_no AS Contact_Number,
tbl_jobs.cost_charged AS Cost,
tbl_jobs.was_accident AS Was_Accident,
tbl_jobs.was_towed AS Was_Towed,
tbl_jobs.job_call_time AS Call_Time,
tbl_jobs.job_arrival_time AS Arrival_Time,
tbl_jobs.job_leaving_scene_time AS Leaving_Time,
tbl_places.place_name AS Place
FROM
tbl_jobs
INNER JOIN tbl_vehicle_models
ON ( tbl_vehicle_models.ID = tbl_jobs.vehicle_model )
INNER JOIN tbl_customers
ON ( tbl_customers.ID = tbl_jobs.customer_id )
INNER JOIN tbl_places
ON ( tbl_places.ID = tbl_jobs.job_place )
这个查询有什么问题?我收到错误消息,指出查询表达式中缺少运算符 '( v.ID = j.vehicle_model ) 内连接 tbl_customers c ON ( c.id = j.customer_id ) INNER JOIN tbl_places p ON ( p.ID = j.job_place'
编辑:这解决了我的问题:
SELECT tbl_vehicle_models.model_name, tbl_vehicle_models.manufacturer, tbl_jobs.vehicle_registration_number, tbl_customers.first_name & " " & tbl_customers.last_name AS Expr1, tbl_customers.address, tbl_customers.contact_no, tbl_jobs.cost_charged, tbl_jobs.was_accident, tbl_jobs.was_towed, tbl_jobs.job_call_time, tbl_jobs.job_arrival_time, tbl_jobs.job_leaving_scene_time, tbl_places.place_name
FROM ((tbl_jobs INNER JOIN tbl_vehicle_models ON tbl_jobs.vehicle_model = tbl_vehicle_models.ID) INNER JOIN tbl_customers ON tbl_jobs.customer_id = tbl_customers.ID) INNER JOIN tbl_places ON tbl_jobs.job_place = tbl_places.ID;
SELECT
tbl_vehicle_models.model_name AS Vehicle_Model,
tbl_vehicle_models.manufacturer AS Manufacturer,
tbl_jobs.vehicle_registration_number AS Registration_Number,
tbl_customers.first_name + " " + tbl_customers.last_name AS Customer_Name,
tbl_customers.address AS Address,
tbl_customers.contact_no AS Contact_Number,
tbl_jobs.cost_charged AS Cost,
tbl_jobs.was_accident AS Was_Accident,
tbl_jobs.was_towed AS Was_Towed,
tbl_jobs.job_call_time AS Call_Time,
tbl_jobs.job_arrival_time AS Arrival_Time,
tbl_jobs.job_leaving_scene_time AS Leaving_Time,
tbl_places.place_name AS Place
FROM
tbl_jobs
INNER JOIN tbl_vehicle_models
ON ( tbl_vehicle_models.ID = tbl_jobs.vehicle_model )
INNER JOIN tbl_customers
ON ( tbl_customers.ID = tbl_jobs.customer_id )
INNER JOIN tbl_places
ON ( tbl_places.ID = tbl_jobs.job_place )
What's wrong with this query? I am getting error saying missing operator in query expression '( v.ID = j.vehicle_model )
INNER JOIN tbl_customers c ON ( c.id = j.customer_id )
INNER JOIN tbl_places p ON ( p.ID = j.job_place'
Edit: This solved my problem:
SELECT tbl_vehicle_models.model_name, tbl_vehicle_models.manufacturer, tbl_jobs.vehicle_registration_number, tbl_customers.first_name & " " & tbl_customers.last_name AS Expr1, tbl_customers.address, tbl_customers.contact_no, tbl_jobs.cost_charged, tbl_jobs.was_accident, tbl_jobs.was_towed, tbl_jobs.job_call_time, tbl_jobs.job_arrival_time, tbl_jobs.job_leaving_scene_time, tbl_places.place_name
FROM ((tbl_jobs INNER JOIN tbl_vehicle_models ON tbl_jobs.vehicle_model = tbl_vehicle_models.ID) INNER JOIN tbl_customers ON tbl_jobs.customer_id = tbl_customers.ID) INNER JOIN tbl_places ON tbl_jobs.job_place = tbl_places.ID;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确定
v.ID
和j.vehicle_model
具有相同的数据类型吗?看起来
v.ID
是一个整数,而j.vehicle_model
是一个字符串,我认为当您尝试使用具有不兼容操作数数据类型的运算符时会发生此问题。
编辑:
然后,尝试更改
为
I think that's a Problem with this concatenation
Are you sure that
v.ID
andj.vehicle_model
have the same data type?Looks like
v.ID
is an integer andj.vehicle_model
a stringI think this problem happens when you try to use operators with incompatible operand data types.
EDIT:
Then, try changing
to
I think that's a problem with this concatenation
这解决了我的问题:
This solved my problem: