SQL查询疑惑 [英] Sql Query doubt
本文介绍了SQL查询疑惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张桌子,属性c1,c2,c3
字段3作为c3包含状态打开"或关闭"
我需要在单个查询中获得未清计数和总计数.
我使用了一个查询,它返回正确的值.但两者计数相同,则仅返回
I have a table , attributes c1,c2,c3
Field 3 as c3 contains status ''open'' or ''close''
I need to get open count and total count in a single query.
I used a query ,it returns proper value. But both count is same then return only
one row.
推荐答案
尝试这一行(用表名替换选项卡):
Try this one (replace tab by your table''s name):
select count(c3), (select count(c3) from tab) from tab group by c3
尝试
选择count(c3),(从选项卡中选择count(c3),其中c3 ="open")从选项卡A
try it
Select count(c3),(select count(c3) From tab where c3=''open'') From tab A
这篇关于SQL查询疑惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文