0

我正在使用 opencart,尝试在管理员中查看客户时出现此错误。我对 SQL 一无所知,但我认为它告诉我需要将 cg.name 放在某个地方。

完整错误:

注意:错误:“字段列表”中的未知列“cg.name”

错误编号:1054

SELECT *, 
    CONCAT(c.firstname, ' ', c.lastname) AS name, 
    cg.name AS customer_group 
FROM oc_customer c 
LEFT JOIN oc_customer_group cg 
    ON (c.customer_group_id = cg.customer_group_id) 
ORDER BY name ASC 
LIMIT 0,100 

在 /home4/pawpostc/public_html/system/database/mysql.php 第 49 行

4

3 回答 3

0

客户组的名称在表格中,customer_group_description因此您还需要将该表格加入到表格中并使用它

SELECT *, 
    CONCAT(c.firstname, ' ', c.lastname) AS name, 
    cgd.name AS customer_group 
FROM oc_customer c 
LEFT JOIN oc_customer_group_description cgd 
    ON (c.customer_group_id = cgd.customer_group_id)
WHERE
    cgd.language_id = 1
ORDER BY name ASC 
LIMIT 0,100

如果语言 ID 不正确,请务必更改 1

于 2012-10-26T10:48:42.200 回答
0

我下载了错误版本的mod...删除了mod,删除了问题...

于 2012-10-31T07:41:33.650 回答
0

文件:admin/model/sale/customer.php

〜第76行

代替:

$sql = "SELECT *, CONCAT(c.firstname, ' ', c.lastname) AS name, cg.name AS customer_group FROM " . DB_PREFIX . "customer c LEFT JOIN " . DB_PREFIX . "customer_group cg ON (c.customer_group_id = cg.customer_group_id)";

和:

$sql = "SELECT *, CONCAT(c.firstname, ' ', c.lastname) AS name, cg.name AS customer_group FROM " . DB_PREFIX . "customer c LEFT JOIN " . DB_PREFIX . "customer_group_description cg ON (c.customer_group_id = cg.customer_group_id)";

于 2016-09-02T19:08:13.807 回答