Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2013, 12:52 PM   PM User | #1
CalumK
New Coder

 
Join Date: Jan 2009
Posts: 53
Thanks: 4
Thanked 3 Times in 3 Posts
CalumK is an unknown quantity at this point
Compare two very large tables

Ok,
So im looking to compare two very large tables.

TableA + TableB

TableA is the table used by the site, and TableB is imported data.

I want to compare the two, and if a row is found in TableA, that matches a row in TableB, I want to delete it (from TableA)

Anyone got any ideas?

Thanks Calum
CalumK is offline   Reply With Quote
Old 02-11-2013, 01:56 PM   PM User | #2
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
Code:
delete A.* from A join B on A.key = B.key
something like that.
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search

Last edited by BubikolRamios; 02-11-2013 at 02:00 PM..
BubikolRamios is offline   Reply With Quote
Old 02-11-2013, 07:22 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
But it's important that the two keys shown in that query are each an index on their respective tables. Else the query will run really slowly.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:44 PM.


Advertisement
Log in to turn off these ads.