sql语句如何同时查询数据总数和其中的一个字段数

具体的要怎么写呢

select count(列名) as count,字段 from 表 group by 字段

不是很清楚你那个 一个字段数 是什么意思

你看下 usertype_id= 后面的参数调试得到的是什么值,一般为空的时候会报这个错
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-04-11
因为你用了conn,tree 显示
可以select count(*) as count,'all'
from userview
union all
select count(distinct category_name ) as count,category_name
from userview本回答被提问者和网友采纳
相似回答