Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Thu Dec 20, 2007 11:03 am
I need to import orders from an external database routinely. Every time somebody clicks "Synchronize DBs" I want to grab all order_ids that I don't already have? How should I go about this? It seems like an easy task... my first instinct was to just select all ids from my db and perform this query:
Code: Select all
SELECT * FROM external_db WHERE order_id NOT IN (@internal_ids)
I'm just wondering if there isn't a better way. Thanks!
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Dec 21, 2007 8:29 am
Useful posts has a thread on selecting stuff in one table that isn't in another.
emmbec
Forum Contributor
Posts: 112 Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico
Post
by emmbec » Mon Jan 14, 2008 5:17 pm
If your database is in SQL Server you could use a DTS, I don't know if it is more efficient, but it is very easy to do.