问题描述:

This question already has an answer here:

  • Querying 2 Tables in a single query

    3 answers

网友答案:
SELECT * FROM posts, posts_category WHERE category = 'category' 
AND 
status = 'publish'
AND
posts_category.post_id = posts.id
ORDER BY date DESC LIMIT 10;
网友答案:
  $sql = "SELECT * FROM posts WHERE status = 'publish' AND pid IN (SELECT pid FROM pcategory WHERE ptype='category_name') ORDER BY date DESC LIMIT 10";
相关阅读:
Top