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