标签:size outer 查找 ;内 local data efault 有关 自身
SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id
UPDATE tdb_goods INNER JOIN tdb_goods_cate ON tdb_goods.goods_cate = tdb_goods_cate.goods_cate SET tdb_goods.goods_cate = tdb_goods_cate.id
SELECT * from tdb_goods INNER JOIN tdb_goods_cate ON tdb_goods.goods_cate = tdb_goods_cate.id
SELECT * from tdb_goods INNER JOIN tdb_goods_cate ON tdb_goods.goods_cate = tdb_goods_cate.id INNER JOIN tdb_goods_brand ON tdb_goods.brand_name = tdb_goods_brand.id;
SELECT * FROM table1 LEFT OUTER JOIN table2 ON table1.id=table2.id
SELECT * FROM table1 RIGHT OUTER JOIN table2 ON table1.id=table2.id
SELECT p.type_id,p.type_name,s.type_name FROM tdb_goods_types AS p LEFT JOIN tdb_goods_types AS s ON s.parent_id = p.type_id;
SELECT p.type_id,p.type_name,count(s.type_name) AS child_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_name ORDER BY p.type_id;
ALTER TABLE tdb_goods_types ADD child_num smallint default 0;
UPDATE tdb_goods_types AS t1 INNER JOIN
(SELECT p.type_id,p.type_name,count(s.type_name) AS child_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_name order by p.type_id) AS t2
ON t1.type_id = t2.type_id SET t1.child_num = t2.child_num;
标签:size outer 查找 ;内 local data efault 有关 自身
原文地址:https://www.cnblogs.com/ladawn/p/8882353.html