Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    58
    Thanks
    4
    Thanked 3 Times in 3 Posts

    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

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Code:
    delete A.* from A join B on A.key = B.key
    something like that.
    Last edited by BubikolRamios; 02-11-2013 at 02:00 PM.
    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

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •