一个Book表中字段name有重复的数据,字段type也有重复的数据,统计每类书各有多少本。

sql数据查询统计总数

select count(distinct(字段名)) from table

select count(*) from table group by 字段