group by 和count,该如何处理

group by 和count

select count(type) from product group by type

结果统计出来的是每组的个数(多行结果)

想统计有多少种类型(单一结果)要怎么写?

除了这种写法,单一语句能完成吗?

select count(1) from (select count(type) from product group by type)



select count(distinct type) from product




探讨

select count(distinct type) from product

group by 和count,该如何处理

相关文章:

你感兴趣的文章:

标签云: