Title: SQL Statement help re categories
Last modified: August 19, 2016

---

# SQL Statement help re categories

 *  [c0y0te](https://wordpress.org/support/users/c0y0te/)
 * (@c0y0te)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/sql-statement-help-re-categories/)
 * The situation is as follows:-
 * I’ve recategorised my content which (for example) was like:-
 * – Local News
    – International News
 * Into more granular categories like:-
 *  – News
    — Local News — International News
 * The only problem is of course that existing posts/content have category tags 
   of (for example) “Local News” but are not currently also tagged into the parent
   category of “News” because of course it didn’t exist when the post was written.
 * Rather than going through my posts manually I’m assuming a smart SQL statement
   of some description against the appropriate WP database table would enable me
   to take all posts with the sub-categories and also tag them with the new parent.
 * Is this the smart/best way to do it?
 * Also – if so – what is the sql statement syntax that I would need to run against
   which table?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [c0y0te](https://wordpress.org/support/users/c0y0te/)
 * (@c0y0te)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/sql-statement-help-re-categories/#post-750708)
 * I’ve come across a plugin (Batch Category Edit) which goes some way towards helping
   this situation, but it’s not perfect. I’d much prefer to just blitz the DB with
   some sql statements if possible rather than navigating through the screen by 
   screen plugin version.
 * SQL genius required? 🙂
 *  Thread Starter [c0y0te](https://wordpress.org/support/users/c0y0te/)
 * (@c0y0te)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/sql-statement-help-re-categories/#post-750831)
 * I’d really love to get my site sorted before the weekend (I want to migrate it
   to a new hoster with the new categories structure sorted before I export the 
   data)…
 * Can some kind soul with SQL lend me a hand and tell me the syntax to do this 
   please? Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL Statement help re categories’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [c0y0te](https://wordpress.org/support/users/c0y0te/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/sql-statement-help-re-categories/#post-750831)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
