• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

oracle SQL

need help with the below query:

expected result:
all value in table "s" that is not in table "o"

select s.*, o.*
  from dba_test.databases              d,
       dba_test.db_parameters_std      s,
       dba_test.db_param_trig_override o
 where d.p_version like s.e_version || '%'
   and o.db_instance = 3629
   and d.instance = o.db_instance
   and s.owner <> 'ALL'
  • 3
  • 2
2 Solutions
eagle_eaAuthor Commented:
table "S" has records
1 a
2 b
3 b

table "o" has records
1 a
2 b

the result expected is
3 b
slightwv (䄆 Netminder) Commented:
Not sure where the original select you posted came from but the example data doesn't seem to match it.

To find the differences between two tables a simple MINUS should work.

select * from tableS
select * from tableO
eagle_eaAuthor Commented:
tableS and table O has other values, the 1st query i said contains more conditions to the query. does minus work when there are other tables mixed in the condition?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

slightwv (䄆 Netminder) Commented:
I do not understand.

Please post actual sample data and expected results.
  FROM dba_test.databases d, dba_test.db_parameters_std s
 WHERE d.p_version LIKE s.e_version || '%'
   AND s.owner <> 'ALL'
               (SELECT NULL
                  FROM dba_test.db_param_trig_override o
                 WHERE AND o.db_instance = 3629
                   AND d.instance = o.db_instance
                   AND s.col1 = o.col1 -- use whatever columns produce the 1,2,3 in your example
                   AND s.col2 = o.col2 -- use whatever columns produce the a,b in your example
eagle_eaAuthor Commented:
yes, that is correct
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now