Forum Moderators: open

Message Too Old, No Replies

Merging Unique emails from 2 tables

merging, table, unique, values

         

kkonline

2:46 pm on Aug 31, 2008 (gmt 0)

10+ Year Member



Hi community,
I have Table 1 and Table2 both having unique emails within them.

Table 1 being the main email Container, I want INTERSECTION of Table 1 and Table2 and the UNIQUE emails between the two should be moved to Table 1.

So now that Table 1 should have All the Unique Emails within itself and also between Table 1 and Table2

ex

Table 1
A
B
C
D

Table 2
F
G
I
B
C

So finally Table 1 should have
A
B
C
D
F
G
I

Note: values B and C already exist in Table 1 and should be ignored.

How to write this query?

kkonline

7:56 pm on Aug 31, 2008 (gmt 0)

10+ Year Member



Issue solved with the following code
INSERT INTO invites
SELECT invites_test.*
FROM invites_test
LEFT OUTER JOIN invites
ON invites.email = invites_test.email
WHERE invites.email IS NULL