Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

040310b on "Manipulating Categories with phpMyAdmin"

$
0
0

1. I tried, by querying phpMyAdmin, to delete older posts in particular categories.

The following "seemed" to successfully show posts in one particular category(1772) that are over 400 days old:

SELECT *
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =1772
AND DATEDIFF(NOW(), <code>post_date</code>) > 400

However, the following query, apparently, failed to delete the aforementioned posts:

delete a,b,c,d
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =1772
AND DATEDIFF(NOW(), <code>post_date</code>) > 400

What did I do wrong, above?

2. Separately, I tried the following phpMyAdmin query to merge my category 7 into my category 112731:

UPDATEwp_term_relationships`
SET term_taxonomy_id = 7
WHERE term_taxonomy_id = 112731;`

That also failed, apparently. What did I do wrong there?


Viewing all articles
Browse latest Browse all 5530

Trending Articles