I want to get exact row count of specified column
Example: Table
Name Id Age
_______________________________
Jon 1 30
Merry 2 40
William 50
David
There are 4 rows in table but i want to count ID column.
I am using below query to achieve it
select count(Id) from table;
But its returning 4 and I know why it is returning 4 but I want output as 2 because there are only two rows in Id column.
How can i achieve it?
尝试这个:
select count(Id) from table where id>0;
在@blabla_bingo 和@Edwin Dijk 的帮助下,我终于通过以下查询实现了它
select count(Id) from table where Id!="";
如果列Id
的值为空字符串 ("") 而不是NULL
,则使用以下查询
SELECT COUNT(Id) FROM table WHERE Id <> ''
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.