在count sql qry中计数withn [英] count withn in count sql qry

查看:104
本文介绍了在count sql qry中计数withn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有这些都是我的sql查询

hi all this is my sql query

'select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1'

,它将返回
行集,我想获取上述查询返回的计数,该怎么做..

it will return
set of rows, i want to get the count of the above query return,how to do this..

推荐答案

如果您想要第一个返回的行数查询:
If you want the number of rows returned by the first query:
select count(*) from (select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1) as t



如果要返回的总行数:



If you want the total number of rows returned :

select sum(rows) from (select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1) as t


尝试一下,您将获得总数

Try this, you will get total count

select COUNT(flag)as rows from mytable where mycolomn0= 'N'



为什么需要这个



Why you need this

'group by mycolomn1




谢谢
Ashish




Thanks
Ashish


那又怎么样:
What about:
SELECT 
  COUNT(*)
FROM
  (select COUNT(flag) from mytable where mycolomn0= 'N'  group by mycolomn1)


这篇关于在count sql qry中计数withn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆