Link to home
Start Free TrialLog in
Avatar of dshi15
dshi15Flag for United States of America

asked on

sql create table statement

Hi Expert,

I have student table,

Id Name

1 Mary  Lee
2 John   Stall
3 Marshall Young



How I can write a query to create a table use each record in Name as column names?
Table structure like this.

Id   [ Mary  Lee]   [John   Stall] [Marshall Young]

 because I have about 100 record in table, I need to create columns dynamic.

Thanks in advance.






Avatar of Norie
Norie

Why would you want to do that?

The table you have is properly structured as far as I can see.
Avatar of dshi15

ASKER

>>The table you have is properly structured as far as I can see.

I typed each column, I want generate dynamic, I need add count under each name later,

result like this


ProgramId  [ Mary  Lee]   [John   Stall] [Marshall Young]

1                      2                          3          2
2                      4                          5          5


I have hundred programs.
ASKER CERTIFIED SOLUTION
Avatar of Daniel_PL
Daniel_PL
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial