Query - relate results (Oracle10g and SQLplus)

Hi,

I have a query that gives me a list of codes:
 SELECT
  DSC.DSC_ID
FROM
D_SUBN DSN,
D_CAD DSC
WHERE
DSC.DSC_ID = DSN.DSC_ID
and  DSN.DSN_DSS is not null;

With this I get something like this:
   DSC_ID
----------
         1
         2
         3
         4
         5
       101
       102
       103
       104
       105
       201
       202
       .
       .
66 rows selected.

So i have this other table called: JM_Cce which has the column DSC_ID too....

So I want to know how can I take the result of the query one (above) to compare with the DCS_ID I have at JM_Cce...

Tks,
Joao
joaotellesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
define 'compare'?

To get 'missing' ones between tables, a simple MINUS will work.

SELECT
  DSC.DSC_ID
FROM
D_SUBN DSN,
D_CAD DSC
WHERE
DSC.DSC_ID = DSN.DSC_ID
and  DSN.DSN_DSS is not null
MINUS
select  DSC_ID  from JM_Cce;

then you'll need to reverse it to find the missing from the other side.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sventhanCommented:
< So I want to know how can I take the result of the query one (above) to compare with the DCS_ID I have at JM_Cce...

If you want the matching values between these tables...

SELECT   DSC.DSC_ID ,j.dsc_id
FROM D_SUBN DSN,D_CAD DSC, JM_Cce j
WHERE DSC.DSC_ID = DSN.DSC_ID
and dsc.dsc_id =j.dsc_id
and  DSN.DSN_DSS is not null;
0
joaotellesAuthor Commented:
tx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.