I am baffled as to the results that I am receiving from the following Queries:
Query #1:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
returns 49462 records.
Query #2:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop = '003'
returns 1397 records.
Query #3:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop = 'DUP'
returns 1952 records.
Query #4:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop IN ('003','DUP')
returns 3349 records (1397 + 1952).
Query #5:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop NOT IN ('003','DUP')
returns only 3319 records.
Shouldn't Query #5 return 46113 records (49462-3349)??? Shouldn't that be logical when using IN...() and NOT IN() ??
Can someone offer an explanation or something I should look for in the data that would cause this??
Thanks in advance.
DMill
======================================
"I wish that I may never think the smiles of the great and powerful a sufficient inducement to turn aside from the straight path of honesty and the convictions of my own mind."
-David Ricardo, classical economist
======================================
Query #1:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
returns 49462 records.
Query #2:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop = '003'
returns 1397 records.
Query #3:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop = 'DUP'
returns 1952 records.
Query #4:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop IN ('003','DUP')
returns 3349 records (1397 + 1952).
Query #5:
SELECT claimno,[lineno],pidate,deneop FROM claimlin
WHERE paiddate BETWEEN (GETDATE() - 11) AND (GETDATE() - 5)
AND deneop NOT IN ('003','DUP')
returns only 3319 records.
Shouldn't Query #5 return 46113 records (49462-3349)??? Shouldn't that be logical when using IN...() and NOT IN() ??
Can someone offer an explanation or something I should look for in the data that would cause this??
Thanks in advance.
DMill
======================================
"I wish that I may never think the smiles of the great and powerful a sufficient inducement to turn aside from the straight path of honesty and the convictions of my own mind."
-David Ricardo, classical economist
======================================