EXISTS and NOT EXIST work the opposite way with Group by
688854May 19 2011 — edited May 22 2011Hello everyboy,,
IAm an ORacle pl/sql developer who is working on 2 databases:
I noticed that when I run a query that contains NOT exist or exists with Group by it works the opposite way, both database have same data and the values 200000000 is a non-existant value.
DATABASE 1:
Select 1 from dual where not exists (
Select max(SGBSTDN.SGBSTDN_TERM_CODE_EFF) from SGBSTDN
Where SGBSTDN.SGBSTDN_PIDM = 20000000000
Group by SGBSTDN_PIDM)
The result :
1
----------
1
1 row selected.
DATABASE 2
Select 1 from dual where not exists (
Select max(SGBSTDN.SGBSTDN_TERM_CODE_EFF) from SGBSTDN
Where SGBSTDN.SGBSTDN_PIDM = 20000000000
Group by SGBSTDN_PIDM)
result:
---------
no rows selected.
BUT when I take off NOT like:
Select 1 from dual where exists (
Select max(SGBSTDN.SGBSTDN_TERM_CODE_EFF) from SGBSTDN
Where SGBSTDN.SGBSTDN_PIDM = 20000000000
Group by SGBSTDN_PIDM)
result:
1
----------
1
1 row selected.
anybody has an explination please?????????????
Edited by: dtabed on May 19, 2011 12:49 AM
Edited by: dtabed on May 19, 2011 12:49 AM
Edited by: dtabed on May 19, 2011 12:51 AM