I am experiencing a weird problem while getting count from one table. The table name is Client and there is a varchar(200) column named CardNo. The database engine is Intersystems Cache and the querying syntax is SQL.
I execute queries below to get the count of Clients having/not having a CardNo. But getting the unexpected results as below.
select count(*) from Client
where CardNo is null
--Result: 38000
select count(*) from Client
where CardNo is not null
--Result: 78000
select count(*) from Client
--Result: 265000
The number of clients without CardNo is 38000. The number of clients with CardNo is 78000. The number of all clients in the table is 265000, which is not equal to 78000 + 38000. How could this happen? And according to the documents there should be no problem with my querying style http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_null