Why is the first statement not returning the number of the 2nd?
select random_selection.randnum,
random_selection.createddate,
random_selection.ozip3,
random_selection.boxid,
random_selection.boxaddr,
random_selection.locdesc,
random_selection.loccity,
random_selection.lastmf,
random_selection.lastsat,
random_selection.boxtype,
random_selection.svcclas,
random_selection.dropzip5,
dropper_city_brk_2.dropper_id
from random_selection, dropper_city_brk_2
where random_selection.ozip3 = dropper_city_brk_2.zip3
and dropper_city_brk_2.dropper_id <> 10002
and random_selection.dropper_id is null
order by dropper_id;
Second statement:
select count(*) from random_selection where dropper_id is null;
Your queries are not the same so your record count would not be the same. You first query is joining on 2 tables and your second query is only getting the record count of one table. Plus you have
WHEREclauses on your first query that are not on the second.If you want your second query to return the same number of records then you have to use the same tables and where clause that you have in the first
EDIT:
Here is a visual explanation of JOINs that might be helpful as a reference.