阅读 6

用Sql语句怎么 将分组查询得到的记录数 统计出来

select b.id,b.name,c.address,a.type
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
复制代码


执行以上sql语句,查询出的结果如有8条记录,那么我怎样在 sql 语句中实现,将这个结果数(8)表示出来。我只想查询出满足这个条件的总的记录的条数。


答:

select count(*) from
(select b.id,b.name,c.address,a.type
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) temp复制代码


关注下面的标签,发现更多相似文章
评论