SQL code:
---测试数据---
if object_id('[grxs]') is not null drop table [grxs]
go
create table [grxs]([tc_name] varchar(2),[tc_sex] int,[sj] datetime)
insert [grxs]
select '张',-1 ,'2010-2-4' union all
select '张',-3 ,'2010-2-4' union all
select '王',-2 ,'2010-2-4' union all
select '李',-1 ,'2010-2-7' union all
select '陈','0','2010-2-7' union all
select '赵',-2 ,'2010-2-10'
if object_id('[jbb]') is not null drop table [jbb]
go
create table [jbb]([bjcr] varchar(2),[pc_class] char(1),[bmmc] varchar(5),[lrsjtj] datetime)
insert [jbb]
select '张','A','车站','2010-2-14' union all
select '王','A','班组','2010-2-16' union all
select '王','B','车站','2010-2-17' union all
select '陈','B','班组','2010-2-17' union all
select '黄','A','车站','2010-2-17' union all
select '赵','B','班组','2010-2-17' union all
select '赵','B','班组','2010-2-20'
我想查两个表2010-2-3到2010-2-28之间的数据:
tc_name tc_sex得分 A类 A车站分 B类 B车站分 A班组分 B班组分 合计得分 实得金额
张 -4 1 -6.6 0 0 0 0 89.4 268.2
王 -2 1 0 &nbs
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......