如何在表的列中返回true / false的计数 [英] How to return count of true/ false in a column of a table

查看:135
本文介绍了如何在表的列中返回true / false的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在表的列中返回true / false的计数。我在sql中有一个包含10列bollean类型的表。现在我必须返回每列中的trues和falses的总数并显示在每个标签中。

How to return count of true/ false in a column of a table. I have a table in sql containing 10 columns with bollean type. Now I have to return the total number of trues and falses in each column and display in each label.

推荐答案

试试这个.. :)



try this.. :)

select count(*),ColumnName  from TableName group by ColumnName  --(boolean Column)

--here that columnName is boolean column true or false


这篇关于如何在表的列中返回true / false的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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