sql语句中如何分组显示模糊查询出的记录数?
分组显示模糊查询出的记录数,这个可以弄出来不?selectcount(*)fromTermination_Call_DetailwhereDigitsDialedlike...
分组显示模糊查询出的记录数,这个可以弄出来不?
select count(*) from Termination_Call_Detail where DigitsDialed like '95%';
如上语句:DigitsDialed值可能为95,92,98,如何在一个sql语句中查出表中DigitsDialed字段以95,92,98开头的记录数?
select DigitsDialed,count(1) from (select substring(DigitsDialed,1,2) as DigitsDialed from Termination_Call_Detail where DATEDIFF(day,[DateTime],getdate())=0) a where a.DigitsDialed in ('%s') group by DigitsDialed
问题已解决,如上。谢谢大家 展开
select count(*) from Termination_Call_Detail where DigitsDialed like '95%';
如上语句:DigitsDialed值可能为95,92,98,如何在一个sql语句中查出表中DigitsDialed字段以95,92,98开头的记录数?
select DigitsDialed,count(1) from (select substring(DigitsDialed,1,2) as DigitsDialed from Termination_Call_Detail where DATEDIFF(day,[DateTime],getdate())=0) a where a.DigitsDialed in ('%s') group by DigitsDialed
问题已解决,如上。谢谢大家 展开
1个回答
2016-01-21 · 知道合伙人软件行家
关注
展开全部
直接用count就可以了,这样:
select COUNT(*) AS CNT
from tableA as a,tableB as b,table C as c
where a.id=b.typeid and b.addid=c.id
group by b.id,b.name,c.address,a.type
但是你怎么还要用group BY呢?如果只是满足where条件的总数的话,就要去掉group by
select COUNT(*) AS CNT
from tableA as a,tableB as b,table C as c
where a.id=b.typeid and b.addid=c.id
group by b.id,b.name,c.address,a.type
但是你怎么还要用group BY呢?如果只是满足where条件的总数的话,就要去掉group by
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询