1 Reply Latest reply: Nov 14, 2012 8:13 AM by Peter vd Zwan RSS

    Merge two recordsets

    967659
      I have two ADODB-connections in VBA to two different databases. I select the same field names in both databases. Is it somehow possible to merge these two recordset and remove duplicates with union and select distinct?
        • 1. Re: Merge two recordsets
          Peter vd Zwan
          Hi,

          You can make a database link from the first to the sencond database.
          then you make an ADODB connection to the first database and query the union there.


          In the first database:
          CREATE DATABASE LINK second_db_link
          CONNECT TO user_name IDENTIFIED BY password
          USING 'second_db_name';
          From ADODB Client to first database
          select
            col1
            ,col2
            ,col3
          
          from
            table_1
          union
          select
            col1
            ,col2
            ,col3
          
          from
            table_1@second_db_link
          Regards,

          Peter