我们正在将PB迁移到SSRS报告,在一份报告中,他们希望将报告显示为以下格式。基本上在检索时按日期列排序,然后按客户名称应用组,它看起来如下所示。
我试图通过SSRS或使用SQL在SSRS中实现相同的功能。
Vicky
2000-01-01 00:00:00.000 400
SMART
2001-01-01 00:00:00.000 600
2001-01-01 00:00:00.000 900
Rocky
2001-01-02 00:00:00.000
Vicky
2002-01-01 00:00:00.000 200
Rocky
2003-01-01 00:00:00.000 300
2005-01-01 00:00:00.000 700
2006-01-01 00:00:00.000 800
SMART
2010-01-01 00:00:00.000 900
Sample script.
Create table #Sample (CustomerName varchar(10),InvDate datetime, Invamount INT)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Rocky','1/2/2001',100)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Vicky','1/1/2002',200)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Rocky','1/1/2003',300)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Vicky','1/1/2000',400)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('SMART','1/1/2001',600)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Rocky','1/1/2005',700)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('Rocky','1/1/2006',800)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('SMART','1/1/2001',900)
Insert into #Sample (CustomerName,InvDate,Invamount) Values ('SMART','1/1/2010',900)
SELECT * from #Sample
ORDER BY InvDate