DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2001


    hi all
    i have 2 tables and with same columns but one column extra in TABLE 2

    i am checking / comparing the data in TABLE1 and TABLE 2 are same or not. if any record or column value is different i need to populate that record. in table 1 around 5000 records and in table 2 8000 records existing.

    i tried like this

    select t1.col1,t1.col2,t1.col3 from table1 t1,table2 t2 where t1.col2 <> t2.col2 and t1.col3 <> t2.col3

    i am getting different results when i am executing the above SQL statement.

    i am not getting correct results and it's also very slow.

    how to compare the 2 tables.

    thanks in advnace.


  2. #2
    Join Date
    Dec 2000
    Ljubljana, Slovenia
    select t1.col1,t1.col2,t1.col3 from table1 t1
    where not existsts
    (select null from table2 t2
    where t2.col1 = t1.col1 and t2.col2=t1.col2 and t2.col3 = t1.col3);

    This will list all the rows from table1 where no rows with the same values in col1, col2 and col3 exist in table2.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Sep 2000
    How do you deal with NULLS in the where clause?

    I've tried nvl on both side but it won't work

    nvl(t2.col1,'X')t2.col1 = nvl(t1.col1,'X')t2.col1


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