问题:怎么查找回复最多的5个帖子 ,帮帮忙1 --创建评论表
2
3 create table Comment
4
5 (
6
7 ID int identity(1,1) not null primary key,
8
9 InvitationID int not null,
10
11 CommentContent text not null
12
13 )
14
15
16
17 --创建帖子表
18
19 create table Invitation
20
21 (
22
23 ID int identity(1,1) not null primary key,
24
25 CategoryName varchar(50) not null,
26
27 InvitationTitle varchar(50) not null,
28
29 InvitationContent text not null
30
31 )
问题:怎么查找回复最多的5个帖子 ,帮帮忙
SELECT TOP 5 COUNT(Comment.ID),Invitation.ID
FROM Comment
LEFT JOIN
Invitation
ON
InvitationID=Invitation.ID
GROUP BY
Invitation.ID
ORDER BY COUNT(Comment.ID) DESC没测,试试行么