DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SQL to find difference in 2 instances

  1. #1
    Join Date
    Oct 2000
    Posts
    449

    SQL to find difference in 2 instances

    Hi..

    I am running a simple SQL statement..

    select count(*) from customer_dedup --9041 rows (a)
    select count(*) from customer_dedup@phc1.world --9258 rows (b)

    SQL> desc customer_dedup
    Name Null? Type
    ----------------------------------------- -------- -------------
    CUSTOMER_NUMBER NOT NULL VARCHAR2(18)
    REF_CUSTOMER_NUMBER VARCHAR2(18)
    MASTER_CUSTOMER_NUMBER VARCHAR2(18)
    UPD_FLAG CHAR(1)

    SQL> -- Customer_number is PK

    I want to see the 217 rows that are in b and not in a

    select customer_number from customer_dedup
    where CUSTOMER_NUMBER not in (select customer_number from customer_dedup@phc1.world )

    Coming out with errors.. What am I missing ?

    Thanks, ST2000

  2. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    isn't it backwards?

    don't you want to select from (b) where rows don't exist in (a)?
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  3. #3
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142

    Re: SQL to find difference in 2 instances

    Originally posted by st2000
    Coming out with errors..
    Errors or the wrong answer? If errors, please post. If wrong answer, see Ken's comment.
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  4. #4
    Join Date
    Oct 2000
    Posts
    449
    Yeah.. you guys are right...

    It should be the other way and I realized after posting it ..

    Thanks ...

    ST2000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width