I have a table A
with column data:
mdr1222
-------
pprgd24
-------
invalid
-------
invalid
abc2345
I want to get a count of the invalid and blank(---). I tried :
SELECT count(data)
from A
where data = 'invalid' and null
but it doesn't work. Can someone please help me figure out what I am doing wrong here?
This should work as well.
SUM(CASE WHEN data IS NULL OR data = 'Invalid' THEN 1 ELSE 0 END)
FROM A
select count(column_name) from table_name where column_name is not null
returns number of rows where column_name
value is not null
select count(column_name) from table_name where column_name is null
returns number of rows where column_name
value is null
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.