I have about 16,000 links in my directory. I want to get rid of most of them except for 1 category and her subcats. What is the easiest and quickest way of doing this?
I think this query will work, but it's your risk: DELETE FROM wsnlinks_links WHERE catid != x AND parentids NOT LIKE '%|x|%'; where x is the category id.
nah didn't work... this is what I got from PhPMyAdmin:
Deleted rows: 0 (Query took 0.0118 sec) SQL-query : DELETE FROM wsnlinks_links WHERE catid != 1 AND parentids NOT LIKE '%|1|%'
nothing was actually deleted - is there another way? Maybe manually dropping top-level tables through PhPMyAdmin....I have no idea whether possible or not though - would prefer to run a query.
Well can you use the search page in phpmyadmin to do a search for those links? That should involve using the LIKE %...% condition with |1| for the parentids field and 1 for the catid field. Once you can search them, can you then change it to 'not' to find what isn't them?
well guess what, the original query you gave me works after all... what I discovered, in a rounabout way, was that I decided to upgrade to the latest PhpMyAdmin (I was on a very old version) - and I ran the query after upgrading and it works very smoothly
Thanks!
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on I want to get rid of most of my links
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
I have about 16,000 links in my directory. I want to get rid of most of them except for 1 category and her subcats. What is the easiest and quickest way of doing this?
Many thanks
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I think this query will work, but it's your risk:
DELETE FROM wsnlinks_links WHERE catid != x AND parentids NOT LIKE '%|x|%';
where x is the category id.
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
nah didn't work... this is what I got from PhPMyAdmin:
nothing was actually deleted - is there another way? Maybe manually dropping top-level tables through PhPMyAdmin....I have no idea whether possible or not though - would prefer to run a query.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Maybe you use a different tables prefix.
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
nope - its in its own database, I have no need to use anything but the defaults...
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Well can you use the search page in phpmyadmin to do a search for those links? That should involve using the LIKE %...% condition with |1| for the parentids field and 1 for the catid field. Once you can search them, can you then change it to 'not' to find what isn't them?
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
well guess what, the original query you gave me works after all... what I discovered, in a rounabout way, was that I decided to upgrade to the latest PhpMyAdmin (I was on a very old version) - and I ran the query after upgrading and it works very smoothly
Thanks!