0 - 2 of 2 tags for creating dynamic columns

Hi I have a requirement where I need yo transpose rows to columns dynamically. That is thd row length is not fixed. Say I have 10 rows today they must get loaded as ten columns and tomorrow if i get 12 rows then 12 columns should be generated. This is yo be done in view.can someone give a solution for this?

Say i have data like this

 

 

COLUMN A

COLUMN B

A

1

A

2

A

3

A

4

B

1

C

1

C

2

 

And i want the output to be in the below format...