データベース スキーマの概要を次に示します。
Table: posts
Columns: id, contents
Table: comments
Columns: id, post_id, contents
これが私がやりたいことです:
SELECT *, (select number of comments from comments table
where post_id = id of posts table) AS num_comments
FROM posts