看板 Database 關於我們 聯絡資訊
※ 引述《CindyLinz (Cindy Wang)》之銘言: : ※ 引述《kidnaper (弗卡夏)》之銘言: : : 各位大大好~~小弟我有一個編號的問題!! : : 我有一個原始的Table : : Item 編號 : : A 1 : : B 2 : : C 3 : : D 4 : : 現在我多了一個表個Table_2 : : Item1 Item2 編號2 : : A B : : A C : : . : : 如果 table name 和欄位就如你的例子. : 如果是要 insert 整個 table 的話你可以用 SQL 這樣寫: : insert into Table_2 (Item1, Item2, `編號2`) : select A.Item, B.Item, concat(A.`編號`,B.`編號`) : from `Table` as A, `Table` as B; : 如果是要 update 的話: : update `Table` as A, `Table` as B, Table_2 as C : set C.`編號2`=concat(A.`編號`,B.`編號`) : where C.Item1=A.Item and C.Item2=B.Item; 我目前可以把table2的編號1和2欄位依照Item內的項目正確編號!! 但是我使用concat(table2.編號1,table2.編號2)時!!卻會出現!! 沒有正確定義concat函數!! 編號1與2資料類型是int如果用+的話!!會加再一起!!@@.. 另外 我是在C# 2010 Express平台上操作的!! 我會在試試 有答案會PO上來!謝謝 大大的回答非常有幫助!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.173.240.44