Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Split a category into subcategories

Quote Reply
Split a category into subcategories
I have a category with over three thousand links. Today I created three sub categories (a-h, i-p, q-z) within this category. I need to divide three thousand links into those three sub categories. My multiple modification does not work. So I go to Database in Admin area and search each link by Id. Then I modify each link so that they go to correct subcategory. After two hundrend links, my head began to spin. Does someone have a better way to do this?

Quote Reply
Re: Split a category into subcategories In reply to
If you are comfortable with SQL, it might be easier. Get a list of the ID's you want to move, and then do a:

UPDATE CatLinks SET CategoryID = new_category_id WHERE LinkID IN (list of id's to move)

and that will move them all. You will need to do a Repair Tables after this to fix the link counts.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Split a category into subcategories In reply to
I've done something like this multiple times... in fact I think we posted a few threads on how to do this a few months back.

But, using Alex's suggestion, the trick is to find the link ID's.

What you do, is execute a

SELECT ID FROM Links WHERE ....

The ... is the criteria you want. If you do this from the SQL monitor, not MySQLMan, you'll be able to select the list of ID's, and paste it into a text editor, then add a ',' at the end of each line, and wrap the whole shebang in a pair of ()'s.

This becomes your IN (....list....) for the query.

MySQLMan table-izes it, while SQL Monitor just outputs it to the screen.

If you use something like EditPlus, you can replace on a regex -- '\n' -- with ',\n' -- and that will create the list, just add the () to it.

If you want more suggestions, I know there was a thread or two about this earlier in the year, with examples of SQL for inserting, moving and updating the CatLinks table. You might find it by searching for something like 'insert into catlinks' or similar.


PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: Split a category into subcategories In reply to
Thanks, Alex and Pugdog. I don't know the command line MySQL. I will follow your leads and figure out something.