GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Another question to MySQL gurus. (https://gfy.com/showthread.php?t=927820)

Pics Traffic 09-15-2009 09:52 AM

Another question to MySQL gurus.
 
So I have a DB that that has 10 tables. Those tables already have some entries in them. I also have sql file that I would like to import in to existing DB and add records from import file but only those that dont exist yet. Basicly some sort of "where not exists" because right now DB has only 400 decords (in main table with primary key "ID").
Both DB and dump file with entries have identical structure. Basicly all records from 401 and up. I hope that makes sense.

Pics Traffic 09-15-2009 09:57 AM

Looks like INSERT IGNORE INTO is doing it ..

GrouchyAdmin 09-15-2009 10:13 AM

If the IDs match you could be really lazy and just set (if not already) that record as a unique key, then undo the damage after the import.

If you just want to ignore duplicates, INSERT IGNORE is likely what you need.

Pics Traffic 09-15-2009 10:16 AM

Quote:

Originally Posted by GrouchyAdmin (Post 16321624)
If the IDs match you could be really lazy and just set (if not already) that record as a unique key, then undo the damage after the import.

If you just want to ignore duplicates, INSERT IGNORE is likely what you need.

yes, insert ignore did it. Totaly forgot about it.


All times are GMT -7. The time now is 09:14 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123