【发布时间】:2009-06-10 20:53:33
【问题描述】:
我有两张桌子,像这样:
#Articles:
ID | Title
1 "Article title"
2 "2nd article title"
#Comments:
ID | ParentID | Comment
1 1 "This is my comment"
2 1 "This is my other comment"
我一直想知道,得到以下结果的最优雅的方法是什么:
ID | Title | NumComments
1 "Article title" 2
2 "2nd article title" 0
这是为 SQL Server 准备的。
【问题讨论】:
标签: sql sql-server