【发布时间】:2010-01-12 14:24:29
【问题描述】:
是否可以通过一个 sql 查询打印出 (PHP) 我所有的博客文章 + 关联的 cmets?
如果有,怎么做?
我在想这个方向:
SELECT p.post_id, p.title, c.comment_body
FROM posts p
LEFT JOIN comments c
ON c.parent_id = p.post_id
但这并没有像我预期的那样成功
【问题讨论】:
-
为什么没有达到你的预期?
-
您希望结果如何?
-
您特别将此标记为 mysql/join 但也许您想尝试mongodb.org/display/DOCS/PHP+Language+Center
MongoDB (from "humongous") is a scalable, high-performance, open source, schema-free, document-oriented database.