If you ever have to retrieve WordPress posts from a MySQL database the following query may be handy:
SELECT wp_posts.post_title as Title, wp_posts.post_date as DATE,
GROUP_CONCAT(wp_terms.name) AS TAGS, wp_posts.post_content as CONTENT FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
INNER JOIN wp_term_relationships ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
INNER JOIN wp_posts ON wp_posts.ID = wp_term_relationships.object_id
WHERE post_type LIKE 'post' AND post_status LIKE 'publish' GROUP BY wp_posts.ID order by post_date
|
I would recommend the WordPress interface layer for general application access to a WordPress database.
Posted in Wordpress