Following is another way of doing this
Declare @tblPersonTask Table
(
DayNmchar(3),
Personvarchar(20),
Tasksmallint
)
insert into @tblPersonTask
select 'sun', 'Jhon', 1 union all
select 'sun', 'Smith', 1 union all
select 'sun', 'Dan', 2 union all
select 'mon', 'Smith', 2 union all
select 'mon', 'Jhon', 3 union all
select 'tue', 'Jhon', 2 union all
select 'tue', 'Smith', 3 union all
select 'tue', 'Dan', 1 union all
select 'wed', 'Smith', 1 union all
select 'thu', 'Jhon', 2 union all
select 'fri', 'Jhon', 2 union all
select 'sat', 'Smith', 3
select Person,
max(Case when DayNm = 'sun' then Task end) AS 'sun',
max(Case when DayNm = 'mon' then Task end) AS 'mon',
max(Case when DayNm = 'tue' then Task end) AS 'tue',
max(Case when DayNm = 'wed' then Task end) AS 'wed',
max(Case when DayNm = 'thu' then Task end) AS 'thu',
max(Case when DayNm = 'fri' then Task end) AS 'fri',
max(Case when DayNm = 'sat' then Task end) AS 'sat'
from @tblPersonTask
group by Person