<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>That looks like a better solution than the one I just suggested.<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message from "Dave J. Hala Jr." &lt;dave@58ghz.net&gt;: -------------- <BR><BR><BR>&gt; It looks like the solution to this problem is make the "SELECT" portion <BR>&gt; of the query a left join. <BR>&gt; <BR>&gt; Something like this: <BR>&gt; <BR>&gt; INSERT INTO table2 (field1,field2) SELECT (field1.table1, field2.table1) <BR>&gt; FROM table1 left join table2 ON field1.table1=field1.table2 <BR>&gt; WHERE table2.field1 IS NULL <BR>&gt; <BR>&gt; :) Dave <BR>&gt; <BR>&gt; <BR>&gt; On Fri, 2006-08-18 at 09:03, Dave J. Hala Jr. wrote: <BR>&gt; &gt; When using mysql 3.26 I had this function that copied records from <BR>&gt; &gt; table1 to table2. The query in the fucntion looks like this: <BR>&gt; &gt; <BR>&gt; &gt; INSERT INTO table2 (field1,field2) SELECT (field1, field2) FROM table1 <BR>&gt; &gt; WHERE field1='X' <BR>&gt; &gt; <BR>&gt; &gt; In table2, field1 was a primary k
ey. If I ran the query, and tried to <BR>&gt; &gt; insert a duplicate, mysql 3.x would just "skip" that insert and continue <BR>&gt; &gt; on. After switching to mysql 4.x, I discovered that when 4.x encounters <BR>&gt; &gt; a duplicate, it stops. This a problem. <BR>&gt; &gt; <BR>&gt; &gt; I took a wild guess and tried making field1 a "unique key" and it didn't <BR>&gt; &gt; solve the problem. Anyone got a work around for this problem? <BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; :) Dave <BR>&gt; -- <BR>&gt; <BR>&gt; Open Source Information Systems, Inc. (OSIS) <BR>&gt; Dave J. Hala Jr., President <DAVE@OSIS.US><BR>&gt; 641.485.1606 <BR>&gt; <BR>&gt; _______________________________________________ <BR>&gt; ciapug mailing list <BR>&gt; ciapug@cialug.org <BR>&gt; http://cialug.org/mailman/listinfo/ciapug </BLOCKQUOTE>
<!-- END WEBMAIL STATIONERY -->

</body>
</html>