あるテーブルから別のテーブルに個別の値を挿入しようとしています。ターゲット テーブルには主キーがあり、ソースとターゲットstudentidを区別して実行すると、ロードは成功します。idを含むソースからターゲットに一連の列をロードしようとするとstudent_id、エラーunique constraint violationed が発生します。の主キーである target の制約は 1 つだけstudentidです。
私のクエリは次のようになります(単なる例)
insert into target(studentid, age, schoolyear)
select distinct id, age, 2012 from source
上記のクエリがエラーを返すのはなぜですか?以下のクエリは完全に正常に機能します
insert into target(studentid)
select distinct id from source
これのトラブルシューティングを手伝ってください。
御時間ありがとうございます。