#Листва постовете от категория 2
SELECT * FROM TABLE_PREFIX_posts p
JOIN TABLE_PREFIX_term_relationships r ON p.ID = r.object_id
JOIN TABLE_PREFIX_term_taxonomy tt ON r.term_taxonomy_id = tt.term_taxonomy_id
JOIN TABLE_PREFIX_term_taxonomy t ON tt.term_id = t.term_id
WHERE t.term_id = 2;
#Листва всички постове
SELECT * FROM TABLE_PREFIX_posts p
JOIN TABLE_PREFIX_term_relationships r ON p.ID = r.object_id
JOIN TABLE_PREFIX_term_taxonomy tt ON r.term_taxonomy_id = tt.term_taxonomy_id
JOIN TABLE_PREFIX_term_taxonomy t ON tt.term_id = t.term_id;
#Изтрива постовете от категория 36
delete a,b,c,d
FROM TABLE_PREFIX_posts a
LEFT JOIN TABLE_PREFIX_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN TABLE_PREFIX_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN TABLE_PREFIX_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN TABLE_PREFIX_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =36;
#Изтрива всички постове
delete a,b,c,d
FROM TABLE_PREFIX_posts a
LEFT JOIN TABLE_PREFIX_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN TABLE_PREFIX_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN TABLE_PREFIX_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN TABLE_PREFIX_terms e ON ( e.term_id = d.term_id );