OpenCart数据库查询问题(语法误解)

时间:2012-06-27 04:11:03

标签: php mysql opencart

OpenCart v1.5.3.1,导出插件:

    $query  = "SELECT pd.*, cg.name FROM `".DB_PREFIX."product_discount` pd ";
    $query .= "LEFT JOIN `".DB_PREFIX."customer_group` cg ON cg.customer_group_id=pd.customer_group_id ";
    $query .= "ORDER BY pd.product_id, cg.name";

有人可以解释一下,pdcg在这里的含义是什么?

在其他地方遇见类似的sintax,但不确定它意味着什么以及如何使用它......

看起来这是一些常见的事情,但我还是很擅长使用数据库,请帮忙: - (

此查询生成错误:

  

注意:错误:'字段列表'中的未知列'cg.name'错误号:   1054

1 个答案:

答案 0 :(得分:1)

pd is the alias name for table `product_discount`
cg is the alias name for table `customer_group`

Notice: Error: Unknown column 'cg.name' in 'field list' Error No: 1054

这实际上意味着表customer_group

中没有名称字段