select p2.element_brand_name, p2.connector_code, p3.vehicle_codes from pz_k1_e12_item p1 left join pz_k1_e07_item p2 on p1.e07_id = p2.id left join pz_k1_e07 p3 on p2.harness_id = p3.id left join pz_k1_e02 p4 on p4.id = p1.e02_id where p3.vehicle_code='SX11AD-2021' GROUP BY p2.element_brand_name,p2.connector_code > 1054 - Unknown column 'p3.vehicle_codes' in 'field list' > 时间: 0.002s
时间: 2024-01-18 12:03:49 浏览: 69
根据你提供的 SQL 语句,错误信息显示在第 1 行,在 SELECT 子句中查询了一个不存在的列 p3.vehicle_codes,需要修改。如果你想查询 p3 表中的 vehicle_code 列,可以将其加入 SELECT 子句中,如下所示:
```
SELECT p2.element_brand_name, p2.connector_code, p3.vehicle_code
FROM pz_k1_e12_item p1
LEFT JOIN pz_k1_e07_item p2 ON p1.e07_id = p2.id
LEFT JOIN pz_k1_e07 p3 ON p2.harness_id = p3.id
LEFT JOIN pz_k1_e02 p4 ON p4.id = p1.e02_id
WHERE p3.vehicle_code='SX11AD-2021'
GROUP BY p2.element_brand_name,p2.connector_code;
```
这样就可以查询到 p3 表中的 vehicle_code 列,并且不会有未知列的错误了。
阅读全文