dbdb please come in

I have a table like talbe1 below that I want to convert to table2.

table1
name math physics chemistry biology ....
john 95 90 100 85 ....

table2
name course grade
john math 95
john physics 90
john chemistry 100
.
.
.


I know the following will work but there are maybe 100 columns in talbe1 so it will be very tedious and am not very confortable having the strings hard coded in it. do you see any better way to accomplish it? thanks.

insert table2 (select name, 'math', math from table1 where name='john');
insert table2 (select name, 'physics', physics from table1 where name='john');
insert table2 (select name, 'chemistry', chemistry from table1 where name='john');
.
.
.

所有跟帖: 

u need a script that creates -not-dbdb- 給 not-dbdb 發送悄悄話 (88 bytes) () 08/25/2004 postreply 23:31:22

請您先登陸,再發跟帖!