dbdb please come in

来源: f64 2004-08-25 21:31:43 [] [旧帖] [给我悄悄话] 本文已被阅读: 次 (826 bytes)
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

请您先登陆,再发跟帖!

发现Adblock插件

如要继续浏览
请支持本站 请务必在本站关闭/移除任何Adblock

关闭Adblock后 请点击

请参考如何关闭Adblock/Adblock plus

安装Adblock plus用户请点击浏览器图标
选择“Disable on www.wenxuecity.com”

安装Adblock用户请点击图标
选择“don't run on pages on this domain”