2

So I am working on two SQL statements, both are for different purposes but I believe the formatting and solution should be the same if not samilar

Subject in the table is

subject                        | character varying           |

The Query I was working on is as follows

SELECT user_id,
    c_id,
    list_id,
    s_time,
    subject
FROM ALL
WHERE send_time BETWEEN '2017-11-24 00:00:00'
        AND '2017-11-28 23:59:00'
    AND subject IN (
        '%Best Leftover Turkey Chili Ever - Black Friday Deals%',
        '%Flash Sale: CLOUD for just $0.37 for one week%',
        '%Save on Anywhere Teacher for Cyber Monday!%',
        '%Roy Moore Hoax Exposed%',
        '%Seamless security for small business - Sonicwall%',
        '%POINT PERFECTION! Old Vine M/Vale Shiraz $60 Now $16.99 Delivered. Parker 
    Rated It 92%',
        '%NEW The Town Apparel + FREE Ground Shipping!%',
        '%HOLY MOLY -  25% Off EVERYTHING + A $20 Gift Card?%',
        '%Free 2 Day Shipping %',
        '%The Dutch%',
        '%Black Friday and Cyber Monday Deal, SAVE NOW!%',
        '%Shop our biggest sale of the year.%',
        '%Appsclusive Week! Nintendo NES Classic Edition & More!?%',
        '%Black Friday continues!%',
        '%Twenty One Percent Off! Cyber Monday 2.0%',
        '%Lettre hebdo%',
        '%Thanks for your persistence%',
        '%Black Friday Sale Continues%',
        '%Cyber Monday Madness%',
        '%Black Friday Sale Ending%',
        '%%',
        '%%',
        '%%',
        '%%',
        '%%',
        );

I have one query that has about 300 different random lines like the above I need to search for.

But then I have another one that has about 90,000 lines I need to search for and the only wild card is in the front

%.dragonflylabs.org
%.thedzifoundation.com
%.mapletoncomm.com
%.beevase.com

It will be searching from a field called URL

url          | text                | YES  |     | NULL    |                |

Is there a way to use a txt or csv file in some one to either import or tap into? Or so I have to actually make a 400 and then a 90,000+ line query?

Both are going to be modified into a georep but ultimately I need to get this part completed and formatted properly before I can even take it there.

JNevill
  • 46,980
  • 4
  • 38
  • 63

1 Answers1

7

You could have your 90k lines stored in a separate table called something like SearchCriteria and then build query dynamically using values in that table. Importing into such table would also be possible (would depend on what graphical mysql client you are using).

Vidmantas Blazevicius
  • 4,652
  • 2
  • 11
  • 30
  • @JamesMadison that shouldn't be a problem. Check this question about importing from csv to mysql via command line https://stackoverflow.com/questions/6605765/importing-a-csv-into-mysql-via-command-line – Vidmantas Blazevicius Feb 13 '18 at 22:39