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?
 
slightwv (䄆 Netminder)Connect With a Mentor 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
 
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
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.

All Courses

From novice to tech pro — start learning today.