View Single Post
Old 09-24-2008, 10:16 PM  
Owen Pierce
Registered User
 
Owen Pierce's Avatar
 
Join Date: Dec 2007
Posts: 95
uhm... you said "DB1" and "DB2".. so.. I'm gonna assume you actually mean databases, although it seems more likely you mean tables... anyways.

INSERT INTO
db1.table
(field1,field2,field3)
SELECT
t2.field1,
t2.field2,
t2.field3
FROM
db1.table t2
LEFT OUTER JOIN db2.table t1 ON (t1.id = t2.id)
WHERE
t1.id IS NULL
Owen Pierce is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote