Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Finding the Differences between tables

5 views
Skip to first unread message

Paul Cartier

unread,
May 2, 2013, 3:01:54 PM5/2/13
to
Hello everyone,
I have two large tables a incremental stage_set and a
incremental target_set with the same data structure.

My task is to a minus between target set and the stage set.
Based on the results I would then perform a delete on a production
table.

Any hints/pointers on how to do this?

Thanks
Paul C


The Natural Philosopher

unread,
May 2, 2013, 3:13:48 PM5/2/13
to
On 02/05/13 20:01, Paul Cartier wrote:
> Hello everyone,
> I have two large tables a incremental stage_set and a
> incremental target_set with the same data structure.
>
> My task is to a minus between target set and the stage set.


If I could understand the above sentence, I might be able to suggest
something.

Could you express it a more more clearly, understanding that English may
not be your first language...
> Based on the results I would then perform a delete on a production
> table.
>
> Any hints/pointers on how to do this?
>
> Thanks
> Paul C
>
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

Luuk

unread,
May 2, 2013, 3:43:42 PM5/2/13
to
If the index of those tables consist of the field i and j...

This would give a list of the records that are in stage_set, and not i
taerget_set:

select i, j from stage_set s
left join target_set t on s.i=t.i and s.j=t.j
where t.i is null

Deleteing these records should be possible with:

delete from stage_set
where (i,j) IN (select i,j from
(select i, j from stage_set s
left join target_set t on s.i=t.i and s.j=t.j
where t.i is null) X
);


0 new messages