我錯了,在我的MySql表中添加一些參考。我認爲一個例子會告訴你我的問題(我真的希望如此)。這是我的表的結構的一個例子:我怎麼能翻譯這個參考
tableMain
id (int)
trackid(varchar)
data(text)
tableArtist
idArtist(int)
ref(varchar)
artist(varchar)
tableEvent
idEvent(int)
ref(varchar)
event(varchar)
這些是DATAS:
tableMain
1 abc primo
2 def secondo
3 ghi terzo
tableArtist
1 abc artist2
2 abc artist4
3 ghi artist5
4 def artist1
5 ghi artist3
tableEvent
1 def event1
2 abc event5
3 222 event3
4 ghi event2
5 abc event4
我想更改tableEvent和tableArtist都與的值替換ref的值在corespondent ID弗羅姆tableMain:
tableMain
1 abc primo
2 def secondo
3 ghi terzo
tableArtist
1 1 artist2
2 1 artist4
3 2 artist5
4 2 artist1
5 3 artist3
tableEvent
1 2 event1
2 1 event5
3 2 event3
4 3 event2
5 1 event4
是否有可能對MySQL或我需要一種腳本(如PHP)來完成的呢?
這個問題是'ref'仍然將是一個'varchar' ... – colinmarc 2011-04-22 20:17:03
@colinmarc :如果需要,數據類型肯定可以隨後修改。 – 2011-04-22 20:18:27