July 3, 2014 at 8:33 am
We are migrating the PB to SSRS report, in one report , they want to show the report as below format. basically sorting by dates column while retrieving then apply group by customer name and it looks like below.
I am trying to achieve the same in SSRS through SSRS or using SQL.
Vicky
2000-01-01 00:00:00.000400
SMART
2001-01-01 00:00:00.000600
2001-01-01 00:00:00.000900
Rocky
2001-01-02 00:00:00.000
Vicky
2002-01-01 00:00:00.000200
Rocky
2003-01-01 00:00:00.000300
2005-01-01 00:00:00.000700
2006-01-01 00:00:00.000800
SMART
2010-01-01 00:00:00.000900
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
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply