5.0.0 - 普通 - 已关闭
先看业务需求 $query
->alias('c')
->field('c.*,count(s.goods_category_id) children_total' . $goodsTotal)
->join('__GOODS_CATEGORY__ s', 's.parent_id = c.goods_category_id', 'left');大意就是根据分类ID获取当前ID下的子类,但由于5.0.12版对alias进行了改进.跟进框架之后发现,在5.0.11时是
Array
(
[cs_goods_category] => c
[__GOODS_CATEGORY__] => s
)而在5.0.12时是Array
(
[cs_goods_category] => s
)所以导致SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table\/alias: 's' 