输入mysql -uroot -p;总是出现错误说是can't connect to mysql server on 'localhost'
2017-08-02
—>delete t1 from tdb_goods as t1
—>inner join (select goods_id,goods_name from tdb_goods group by
goods_name having count(goods_name)>=2) as t2
—>on t1.goods_name=t2.goods_name
—> where t1.goods_id>t2.goods_id;
用的是内连接,结果一样
—>inner join (select goods_id,goods_name from tdb_goods group by
goods_name having count(goods_name)>=2) as t2
—>on t1.goods_name=t2.goods_name
—> where t1.goods_id>t2.goods_id;
用的是内连接,结果一样
select a.type_id as '分类id',a.type_name as '分类名称',count(*) as '下级 类别' from tdb_goods_types a left join tdb_goods_types b on a.type_id=b.parent_id group by a.type_id;
2017-08-01
这节课程8分钟前后老师出现一个多余的动作,可以不用将表格AS成g和b去区分,直接利用之前讲过的表格.columns name就可以了,AS完后还要再去g.columns b.columns,有点麻烦了,只是个人理解,可能老师认为用g和b省去打表格名的麻烦了。
2017-08-01
insert tdb_goods_cates(cate_name) (select goods_cate from tdb_goods group by goods_cate);
2017-08-01