title: How to combine two Post/Category tables MYSQL SELECT queries into one
body: <p>I have two MySQL queries:</p>
  
  <pre><code>1) "SELECT ID,post_title,post_category,post_perma FROM ".TBL_POSTS."
     WHERE  published='1' AND page='0' ORDER BY  ID DESC LIMIT 10"
  
  2) "SELECT p.cat_ID,p.cat_nicename FROM ".TBL_CATEGORIES." n, ".TBL_CATEGORIES." p
     WHERE n.lft BETWEEN p.lft AND p.rgt AND n.cat_ID='".post_category."' ORDER BY p.lft
  </code></pre>
  
  <p>First query selects posts and then second select the Path of the category by <code>post_category</code> please note that <code>post_category</code> will be taken from first query means <code>post_category</code> is common in both table.. in first table it is named as <code>post_category</code> and in second it is <code>cat_ID</code></p>
  
  <p>Right now I am running it in foreach loop which is not good. Also one thing to be noticed that second query will also return Array and that one array should correspond to <code>post_category</code></p>
  
  <p>Can any SQL expert help me?</p>
  
  <p>Many Thanx</p>