Hello
I am having problems with a query that I am developing on our Data Warehouse.
Briefly, the problem is this:
When I cound the number of records in a table with a null value, I get 1.3 million. If I count the number of records with a null value AND some other clause, I get more records. I think that I should ALWAYS get the same number of records or less. The 2nd query was originally using EXISTS - but this had the same result.
I am using SQL Server 2000.
Here is the SQL:
select count( * )
from dbo.imp_tblPerson p
where p.[HondaCustomerProspectIndicator] is null
Returns 1317608 records (i.e 1.3 million)
select count( * )
from dbo.imp_tblPerson p
where p.[HondaCustomerProspectIndicator] is null
and (select count(*) from dbo.imp_tblEntityProductRelationship eccr
where eccr.intEntityURN = p.intEntityURN
) > 0
Returns 1467258 records (i.e 1.4 million)
Thank you
Mark
Honda UK
I am having problems with a query that I am developing on our Data Warehouse.
Briefly, the problem is this:
When I cound the number of records in a table with a null value, I get 1.3 million. If I count the number of records with a null value AND some other clause, I get more records. I think that I should ALWAYS get the same number of records or less. The 2nd query was originally using EXISTS - but this had the same result.
I am using SQL Server 2000.
Here is the SQL:
select count( * )
from dbo.imp_tblPerson p
where p.[HondaCustomerProspectIndicator] is null
Returns 1317608 records (i.e 1.3 million)
select count( * )
from dbo.imp_tblPerson p
where p.[HondaCustomerProspectIndicator] is null
and (select count(*) from dbo.imp_tblEntityProductRelationship eccr
where eccr.intEntityURN = p.intEntityURN
) > 0
Returns 1467258 records (i.e 1.4 million)
Thank you
Mark
Honda UK