Need subset of rows in a table to be placed in new column parallel to existing column in resultant table

This is how the data is in the sql server database table:

Sql data table

ID cases value A value B
1 10 a d
2 10 b e
3 10 c f
4 20 1 4
5 20 2 5
6 20 3 6
7 30 I 1V
8 30 II V
9 30 III V1

I need a query which return the result like this:


| 10 | 20 | 30 |
|______ ||__ |
| a | d | 1 | 4 | I | 1V |
| b | e | 2 | 5 | II | V |
| c | f | 3 | 6 | III | V1 |
|___|___|__||___ ||

hi

i was able to get the first row

I am not able to understand the rest part
Please help me understand
Thanks

create data script

drop table harish_temp
go

create table harish_temp
(
ID int null,
cases int null,
valueA varchar(10) null,
valueB varchar(10)
)
go

insert into harish_temp select 1,10,'a','d'
insert into harish_temp select 2,10,'b','e'
insert into harish_temp select 3,10,'c','f'
insert into harish_temp select 4,20,'1','4'
insert into harish_temp select 5,20,'2','5'
insert into harish_temp select 6,20,'3','6'
insert into harish_temp select 7,30,'I','1V'
insert into harish_temp select 8,30,'II','V'
insert into harish_temp select 9,30,'III','V1'
go

first row

select abc,case1,case2,case3
from
(
select abc , cases
,'case'+cast(row_number() over(partition by abc order by abc) as varchar(20))
as colseq from
(select distinct 'abc' as abc , cases from harish_temp) a
) temp
PIVOT
(
MAX(cases) FOR colseq in (case1,case2,case3)
) PIV

I think something like this might do

Query
with cte
  as (select valuea
            ,valueb
            ,row_number() over(partition by cases
                                   order by valuea
                              )
             as rn
            ,dense_rank() over(order by cases)
             as dr
        from yourtable
     )
select max(case when dr=1 then valuea else null end) as valuea1
      ,max(case when dr=1 then valueb else null end) as valueb1
      ,max(case when dr=2 then valuea else null end) as valuea2
      ,max(case when dr=2 then valueb else null end) as valueb2
      ,max(case when dr=3 then valuea else null end) as valuea3
      ,max(case when dr=3 then valueb else null end) as valueb3
  from cte
 group by rn
 order by rn
;