Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> MINUS problem
Following are two count queries and their results. I want to isolate the records that appear in the count of the 1st query but not in the 2nd. To that end, I wrote the MINUS query which is also below.
PROBLEM: The MINUS query returns the same number of rows as the 1st query counts. Why? How can I fix this?
TIA, 1st query and result:
1 select count(*) from (
2 select distinct
3 gurmail_pidm, 4 gurmail_term_code, 5 gurmail_letr_code
COUNT(*)
4363
2nd query and result:
1 select count(*) from (
2 select distinct
3 gurmail_pidm, 4 NULL, !!!! HERE'S THE DIFFERENCE !!! 5 gurmail_letr_code
COUNT(*)
4357
MINUS query that returns 4363 rows:
1 (select distinct
2 gurmail_pidm, 3 gurmail_term_code, 4 gurmail_letr_code, 5 gurmail_date_printed
10 gurmail_pidm, 11 NULL, 12 gurmail_letr_code, 13 gurmail_date_printed
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Phil R Lawrence phone: 610-758-3051 Programmer / Analyst e-mail: prl2_at_lehigh.edu 194 Lehigh University Computing Center E.W. Fairchild - Martindale, Bldg. 8B Bethlehem, PA 18018 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Received on Thu Mar 12 1998 - 00:00:00 CST
![]() |
![]() |