How to query for all posts within custom WordPress categories
<p>I have a WordPress database that I need to query with pure MySQL to select all posts from a custom taxonomy called 'guide_category'. I also want to order the results by the <code>wp_terms.name</code> and within those order by <code>wp_posts.name</code>. A post can reside within multiple categories.</p>

<p>So results should looks something like:</p>

<pre><code>Category_A
    Post A
    Post B
    Post C
Category_B
    Post A
    Post B
    Post C
Category_C
    Post A
    Post B
    Post C
</code></pre>