I have the following two sql's. The first one is by me and the second one(supposed to be more efficient) is recommended by the DBA.
SELECT COUNT(*) FROM TABLE1 WHERE ACCOUNT_NUMBER
IN (SELECT ACCOUNT_NUMBER FROM TABLE2);
COUNT(*)
----------
259463
SELECT COUNT(a.*) FROM TABLE1 a, Table2 b
WHERE a.ACCOUNT_NUMBER = b.ACCOUNT_NUMBER;
COUNT(a.*)
----------
335228
Both of them give different counts. Can somebody tell why is there a difference in the count? Also why is the 2nd one supposed to be more efficient.
Thanks,
Pramod
SELECT COUNT(*) FROM TABLE1 WHERE ACCOUNT_NUMBER
IN (SELECT ACCOUNT_NUMBER FROM TABLE2);
COUNT(*)
----------
259463
SELECT COUNT(a.*) FROM TABLE1 a, Table2 b
WHERE a.ACCOUNT_NUMBER = b.ACCOUNT_NUMBER;
COUNT(a.*)
----------
335228
Both of them give different counts. Can somebody tell why is there a difference in the count? Also why is the 2nd one supposed to be more efficient.
Thanks,
Pramod