Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL problem

SQL problem

From: Phil R Lawrence <prl2_at_lehigh.edu>
Date: Wed, 24 Jun 1998 09:44:45 -0400
Message-ID: <6mqvs7$pn6@fidoii.cc.Lehigh.EDU>


Hello, I have two SQL statements which *should* return the same count. I can't figure out why they don't. Can anyone tell me why?

Number 1:
SELECT count(saradap_pidm)
FROM saturn.saradap
WHERE saradap_term_code_entry = '199840'   and saradap_admt_code in ('IN', 'NA', 'ED', 'DA')   and exists(select 'x' from saturn.sarappd

            where sarappd_apdc_code in ('Z', 'AZ', 'DZ')
            and saradap_appl_no = sarappd_appl_no
            and sarappd_pidm = saradap_pidm)
  and not exists(select 'x' from saturn.sarappd
                where sarappd_apdc_code in ('SF', 'SH')
                and saradap_appl_no = sarappd_appl_no
                and sarappd_pidm = saradap_pidm)

Number 2:
SELECT count(saradap_pidm)
FROM saturn.saradap, saturn.sarappd

WHERE   sarappd_pidm = saradap_pidm
  and   saradap_appl_no = sarappd_appl_no
  and   saradap_term_code_entry = '199840'
  and   saradap_admt_code in ('IN', 'NA', 'ED', 'DA')
  and   sarappd_apdc_code in ('Z', 'AZ', 'DZ')
  and   sarappd_apdc_code not in ('SF', 'SH')


--


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 Wed Jun 24 1998 - 08:44:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US