Re: Best way to load differential rows on table with composite key
Posted in 1998
Kevin wrote:
>
> Sorry I wasn't very specific, again attribute to Mon morning, I'm trying to
> do this with SQL.
> Thanks again!
> Kevin
>
> Kevin wrote in message <6uo7p1$b46$1@news1-alterdial.uu.net>...
> >Hey!
> >I'm trying to load the rows from table a that are not in table b, into
> table
> >b.
> >The table has a composite key and has a large number of rows. I'm sure this
> >is a no brainer, but seeing as it's Mon morning I think I qualify.
This takes two steps:
Select rowids using an outer join of the two tables into a temp table.
Then join the temp table to table a where b_rowid is NULL in an INSERT
INTO...SELECT ... FROM statement:
select a.rowid a_rowid, b.rowid b_rowid
from a, outer b
into temp fred;
insert into b
select ...
from a, fred
where a.rowid = fred.a_rowid
and fred.b_rowid IS NULL;
Art S. Kagel