LoginSignup
0
0

More than 5 years have passed since last update.

テーブル間での同一名のカラムへのフィールドデータのコピー

Posted at

他のテーブルから列名が同じであるフィールドデータを全てコピーする

使う時にやたらと忘れてしまうので備忘録として残しておく。

areaテーブル内のカラムcodeをstat_valuesテーブルのカラムcodeへコピーする。

insert into stat_values select code from area;

これだけ。

コピー元の表でカラムcodeを選択しておけば、勝手に同一カラムへコピーしてくれる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0