如何查询“SQL计算表中一个列中各数的出现次数”?
1个回答
展开全部
select countB)from A group by B order by B
SQL语句就可以做了,例检索表格aaa,添加一列“re_num”,显示a列值重复的次数,
次数为表格按a列分组计算记录数:
select a,count(a) as 're_num' from aaa group by a,
select a1.a2.re_num from
aaa a1
join
(select a,count(a) as 're_num' from aaa group by a) a2
on a1.a = a2.a;
select sum(datac.COUNT_VALUE)
from T_JL_COUNT_DATA datac
, T_JL_XC_RESULT a
where datac.COUNT_NO=45 and a.id=datac.RESULT_ID。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询