使用 postgres,我写了这个 SQL 请求:
SELECT projects.id
, projects.title
, comments.message as comment_message
FROM "projects"
RIGHT OUTER JOIN comments
ON comments.project_id = projects.id
GROUP BY projects.id, comments.message
我有这种结果:
id | title | comment_message
----+----------------+-----------------
6 | simple project | simple comment
6 | simple project | simple message
是否有可能只有第一个结果?我只想按项目获得一个结果。
谢谢!