drop table tb;
create table tb(inspect_name varchar(20), vdatetime2 datetime, vtime int, jcnr varchar(20),rank varchar(2),uplj varchar(2));
insert into tb(inspect_name, vdatetime2, vtime,jcnr,rank,uplj)
select
'王','2010-01-03 00:33:52',60,'内容','A' ,'Y'union all select
'王','2010-01-03 00:33:52',67,'内容','A' ,'Y'union all select
'王','2010-01-03 12:32:50',100,'内容','B','Y' union all select
'王','2010-01-04 00:33:52',57,'内容','B' ,'Y'union all select
'王','2010-01-04 00:33:52',62,'内容','B' ,'Y'union all select
'王','2010-01-04 12:32:50',100,'内容','A','Y' union all select
'王','2010-01-09 00:33:52',60,'内容','B' ,'Y'union all select
'王','2010-01-09 00:33:52',65,'内容','B' ,'Y'union all select
'王','2010-01-09 12:32:50',130,'内容','B' ,'Y'union all select
'王','2010-02-13 00:33:52',60,'内容','B' ,'Y'union all select
'王','2010-03-13 22:33:52',65,'内容','A' ,'Y'union all select
'王','2010-03-13 12:32:50
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......