INSERT tdb_goods_cates (cate_name) SELECT goods_cate FROM tdb_goods GROUP BY goods_cate;
INSERT tdb_goods_cates (cate_name) SELECT DISTINCT goods_cate FROM tdb_goods;
INSERT tdb_goods_cates (cate_name) SELECT DISTINCT goods_cate FROM tdb_goods;
2020-06-14
你们这样写试试
SELECT p.type_id,p.type_name,count(s.type_name) num FROM tdb_goods_types AS p LEFT JOIN tdb_goods_types AS s ON s.parent_id = p.type_id GROUP BY p.type_id ORDER BY p.type_id;
SELECT p.type_id,p.type_name,count(s.type_name) num FROM tdb_goods_types AS p LEFT JOIN tdb_goods_types AS s ON s.parent_id = p.type_id GROUP BY p.type_id ORDER BY p.type_id;
2020-05-21
数据插入:
若省略列名,需为每个列赋值
若没有为记录的某个字段赋值,则显示NULL
若不给自增字段赋值,或为其赋值为NULL,或为其赋值为DEFAULT,都不改变其规则
若列有定义默认约束。当插入记录时,如果没有为字段赋值或为其赋值为DEFAULT,则自动赋予默认值
若省略列名,需为每个列赋值
若没有为记录的某个字段赋值,则显示NULL
若不给自增字段赋值,或为其赋值为NULL,或为其赋值为DEFAULT,都不改变其规则
若列有定义默认约束。当插入记录时,如果没有为字段赋值或为其赋值为DEFAULT,则自动赋予默认值
2020-05-19