查询大类下小类的记录总数的SQL语句

来源:百度知道 编辑:UC知道 时间:2024/06/21 14:22:32

create table blog
(
id int indentiy(1,1),
type varchar(20), --博客分类
....

)

select type ,count(type) as 总数 form blog
group by type

select sum(博客分类) as 总数 form table

在where里嵌套就行了。这个图第一局我就没看清楚。