select u,sum(case when u=1 then monday

when u=2 then tuesday

when u=3 then wednesday

when u=4 then thursday

when u=5 then friday

when u=6 then saturday

else sunday

end) as x

from required

,(select 1 as U union select 2 as u union select 3 as u union select 4 as u

union select 5 as u union select 6 as u union select 7 as u ) as x

group by U

) as Z