Currently data is like below:-
SQL Query:-
declare @t table
(
Id int,
ReportedDate DATE,
[Name] varchar(10)
)
insert into @t
select 1,'2016-01-01','ab' union all
select 2,'2016-01-01','a' union all
select 1,'2016-01-20','hha' union all
select 2,'2016-01-20','jnsjja' union all
select 1,'2016-01-01','jsjb' union all
select 2,'2016-01-01','sjjjwb' union all
select 1,'2016-01-20','bjd' union all
select 2,'2016-01-20','bwjw'
select * from @t order by id, ReportedDate
Expected Result:-
It's working in case we have only 2 columns, one is Id & other one is anything. But for mutiple column I am unable