How can this be done with MySQL or do I need to write a php script -
i have mysql database news under there's table called links. 1 of colum called link_title , have content without quotes "neil-degrasse-tyson-why-you-will-levitate". there 40,000 rows in table.
i have txt file called topurls.txt google analytics shows top visited 1500 urls on site. 1 line, 1 url. , urls have been cleaned match content of link_title in db.
can guide me on mysql script clean links table of rows not have link_title matches 1 of 1500 urls in text file. or need program in php or something?
load topurls.txt table. let's call topurls , call single column of table url. match link_title topurls , delete on mis-match
delete links link_title not in ( select url topurls)
this works if content of google file exactly matches existing database rows. otherwise have had further where
clause sub-select withsome string manipulation in it.
Comments
Post a Comment