Bootstrap

SQL语句出现错误:ERROR 1060 (42S21): Duplicate column name 'name'

查询语句出现列名相同的情形
创建视图时,如果sql查询语句出现列名相同的情形,需要将列名重命名一下。
根据错误提示Duplicate column name ‘name’,可知是列名出现重复。
需将create view v_cate_names as select g.id,g.name,b.name,g.price from goods as g inner join goods_cates as c on g.cate_id = c.id inner join goods_brands as b on g.brand_id=b.id;

改为:create view v_cate_names as select g.id,g.name as g_name,b.name,g.price from goods_brands as b on g.brand_id=b.id;

;