SELECT product.*,(selectcount(comment.id)from commentwhere product.id=comment.entity_id) comment_countFROM `product` limit 5;
当出现带括号的子查询的时候,先忽略括号。最后再把括号里字段加进去。这样比较好理解
group by 之后可以跟1个或者多个序列。多重分组
SELECT product.*,(selectcount(comment.id)from commentwhere product.id=comment.entity_id) comment_countFROM `product` limit 5;
当出现带括号的子查询的时候,先忽略括号。最后再把括号里字段加进去。这样比较好理解
group by 之后可以跟1个或者多个序列。多重分组