![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
|
![]() 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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
|
Looks like INSERT IGNORE INTO is doing it ..
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
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.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
|
yes, insert ignore did it. Totaly forgot about it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |