pvsbandi
asked on
Data to display differently-SQL Server
Hi All,
We are on SQL Server 2012 and we have a table that displays the data that's changed for a customer.
My task is to display in such a way that the left section has the initial data and the right section has the changed data.
i have embedded the grid that has this structure and how the desired structure is.
Please help.
WITH TBL_CUST(ID,NAME,DOB,UPDAT ED_BY,UPDA TE_DT)
AS
(SELECT *
FROM (
VALUES
(1,'SAM','01/01/1981','MIK E','10/01/ 2006')
,(1,'SAMUEL','01/01/1982', 'JAMES','0 2/13/2007' )
,(1,'SAMIEL','01/01/1982', 'JACOB','0 5/21/2010' )
,(2,'DAVE','10/20/1978','S HARON','08 /15/2015')
) AS A(ID,NAME,DOB,UPDATED_BY,U PDATE_DT)
)
Experts-Example.xlsx
We are on SQL Server 2012 and we have a table that displays the data that's changed for a customer.
My task is to display in such a way that the left section has the initial data and the right section has the changed data.
i have embedded the grid that has this structure and how the desired structure is.
Please help.
WITH TBL_CUST(ID,NAME,DOB,UPDAT
AS
(SELECT *
FROM (
VALUES
(1,'SAM','01/01/1981','MIK
,(1,'SAMUEL','01/01/1982',
,(1,'SAMIEL','01/01/1982',
,(2,'DAVE','10/20/1978','S
) AS A(ID,NAME,DOB,UPDATED_BY,U
)
Experts-Example.xlsx
ASKER
Thanks Pawan! Almost there.
The only extra row is the third one, where there is no further change, but still shows up as a separate row.
Can we get rid of it?
The only extra row is the third one, where there is no further change, but still shows up as a separate row.
Can we get rid of it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks much!
Open in new window
Output
Open in new window
Hope it helps !!