LoginSignup
160

More than 5 years have passed since last update.

selectした結果をinsertする

Posted at

毎回忘れるのでメモ

以下の書き方はNG(毎回やらかす)

insert into table_name (col1, col2, ...)
values (select col1, col2, ... from table2_name);

正解はこちら

insert into table_name (col1, col2, ...)
select col1, col2, ... from table2_name;

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
160