[SQL ] 一個怪問題

看板Database作者 (我是一只嗩吶)時間18年前 (2007/11/14 23:36), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
我遇到一種情況, 有兩個table, table a: ftid | ftname -------|--------- 0 | name1 1 | name2 2 | name3 table b : faid | ftid | ftname | content -------|----------|----------|----------- 0 | 0 | name1 | content1 1 | 0 | name1 | content2 2 | 1 | name2 | content3 3 | 1 | name2 | content4 4 | 1 | name2 | content5 5 | 2 | name3 | content6 類似這樣, 其中table a的ftid跟table b的faid都是主鍵值與自動累加1, 而table b的ftid與ftname是從table a來的, 假如我想要從table b中,找出相同的ftid與ftname, 把它們的content加在一起,像table c: ftid | ftname | content -------|----------|--------------------------- 0 | name1 | content1content2 1 | name2 | content3content4content5 2 | name3 | content6 請問這有辦法下SQL做到嗎? 先說聲感謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.162.50
文章代碼(AID): #17EnOG8p (Database)
文章代碼(AID): #17EnOG8p (Database)