+ Reply to Thread
Results 1 to 6 of 6

Thread: Load using infile, but skip if in another table

  1. #1
    Barn Regular bryceowen is on a distinguished road bryceowen's Avatar
    Join Date
    Sep 2008
    Location
    Jacksonville, FL
    Posts
    93
    Rep Power
    4

    Load using infile, but skip if in another table

    Here's the scenario... I'm working in a TM department and I have the Federal DNC list for our calling areas loaded in a table called 'ftcdnc' in my database. I have a huge (2gb+) list of leads that I want to load into the database from a CSV file, but I want to skip any leads that have a matching phone number in the ftcdnc table.

    I realize this process will require close to 100% of the system resources, but I only need to do it once to strip out the DNC numbers. Then I can export the scrubbed list for use in Vicidial.

  2. #2
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    why not just load the entire CSV file, then just delete the records you don't need?
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  3. #3
    Barn Regular bryceowen is on a distinguished road bryceowen's Avatar
    Join Date
    Sep 2008
    Location
    Jacksonville, FL
    Posts
    93
    Rep Power
    4

    How would I do that? I have my dnc list loaded and leads loaded in their tables. I could make a PHP page that loops through every lead record, but surely there's an easier way through the mysql console...

  4. #4
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    couldn't you just load the CSV file then run a quick delete in the database. something like this:
    Code:
    delete from tbl_TableName where field in (select field from tbl_TableName2)
    
    this would work in SQL Server, not sure about MySQL. I'm still in the process of learning it.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  5. #5
    Barn Regular bryceowen is on a distinguished road bryceowen's Avatar
    Join Date
    Sep 2008
    Location
    Jacksonville, FL
    Posts
    93
    Rep Power
    4

    Well, I haven't deleted anything as yet, but I did try:
    Code:
    SELECT COUNT(*) FROM leads l,ftcdnc f WHERE l.phone NOT IN(f.phone);
    
    to see if it would return the total records that DIDN'T match to the DNC list and it froze the machine (over 10m DNC numbers comparing to 8m leads). I waited about 10 minutes before I forced the mysql console to close so the people who needed to access the DB could... Would that be the proper syntax for what you're suggesting?
    Code:
    DELETE FROM leads WHERE phone IN(ftcdnc.phone);
    
    On an unrelated note... Good GOD, this company needs to invest in a real server for this and not use a Dell POS with 256mb of ram... I'm sorely tempted to do this at home where I have a REAL rig. But I do get paid hourly, so I guess it's better for me in the end.

  6. #6
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    can you try the sub-select as i posted above. not sure which version of mySQL you're using, but i believe MySQL 5+ allows them.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

+ Reply to Thread

Similar Threads

  1. Could not load file or assembly...
    By Shem in forum .NET Development
    Replies: 2
    Last Post: September 11th, 2010, 12:12 AM
  2. Load Subforms at Runtime (save initial loading speed of main form)
    By boblarson in forum Access Database Samples
    Replies: 0
    Last Post: January 11th, 2009, 11:45 PM
  3. Application_Error invoked every page load
    By Wolffy in forum .NET Development
    Replies: 5
    Last Post: May 7th, 2008, 06:23 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO