1
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)INNER JOIN 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;
4

2 回答 2

0

您确定v.ID并且j.vehicle_model具有相同的数据类型吗?

看起来v.ID是一个整数和j.vehicle_model一个字符串

我认为当您尝试使用具有不兼容操作数数据类型的运算符时会发生此问题。

编辑:然后,尝试改变

c.first_name + " " + c.last_name

c.first_name & " " & c.last_name

我认为这是这种串联的问题

于 2011-04-24T13:56:34.777 回答
0

这解决了我的问题:

 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;
于 2011-04-26T05:32:19.123 回答