有两个表如下;产品表,产品评论表;
查询全部产品信息和每种产品的评论数量;
这也是子查询的一种;
select * from product1;
select * from comment;
SELECT product1.*,(select count(id) from comment where product1.id=comment.productid) 评论数量 FROM product1;
有两个表如下;产品表,产品评论表;
查询全部产品信息和每种产品的评论数量;
这也是子查询的一种;
select * from product1;
select * from comment;
SELECT product1.*,(select count(id) from comment where product1.id=comment.productid) 评论数量 FROM product1;