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”