我不得不加入2代表與SQL以特殊的方式:加入2代表與SQL
TABLE1有田組和成員,TABLE2有田集團和MASTER。 我必須通過將TABLE1複製到TABLE3並搜索TABLE2(如果從TABLE1有一個GROUP並且如果將GROUP和MASTER複製到TABLE3)來創建具有字段GROUP和ID的新TABLE3。
例子:
table1
:
group member
1 a
1 b
1 c
2 x
3 y
table2
:
group master
3 n
3 z
1 k
9 v
2 m
7 o
8 p
預期結果,表3:
group id
1 a from table1
1 b from table1
1 c from table1
1 k from table2
2 x from table1
2 m from table2
3 y from table1
3 z from table2
3 n from table2
我希望everyth ing很清楚。
那麼什麼是SQL查詢?
感謝,海因
看看「工會」。 –
您正在使用哪些DBMS? –