t1、t2、t3 という 3 つのテーブルがあります。実際、t3 は、多くのテーブルからの結合を使用した選択クエリの結果です。t3 から t1 および t2 にデータを一括挿入する必要があります。 t3 からのいくつかのデータと共に。T1 には、internalid と date の一意の組み合わせがあります。テーブルの構造は次のとおりです。
Table t1: columns: t1id identity(1,1), internalid, date
Table t2: columns: t2id,t1id,value
table t3: columns: t3id,internalid, date, value
egif t3 には次のデータがあり、t1 と t2 には次のデータがあります。
t3:
t3id |internalid| date |value
1 | 11 | x | 5
2 | 11 | y | 4
3 | 13 | x | 7
4 | 11 | x | 3
次に、t1 と t2 を次のように挿入する必要があります。
t1:
t1id | internalid | date
1 | 11 | x
2 | 11 | y
3 | 13 | x
と
t2:
t2id | t1id | value
1 | 1 | 5
2 | 2 | 4
3 | 3 | 7
4 | 1 | 3