PHP+study

http://antas.jp/blog/kinokuni/2006/10/mysql41load_data.html

参考URL

 INSERT [LOW_PRIORITY | DELAYED] [IGNORE]

       [INTO] tbl_name [(col_name,...)]
       VALUES ((expression | DEFAULT),...),(...),...
       [ ON DUPLICATE KEY UPDATE col_name=expression, ... ]

または  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]

       [INTO] tbl_name [(col_name,...)]
       SELECT ...

または  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]

       [INTO] tbl_name
       SET col_name=(expression | DEFAULT), ...
       [ ON DUPLICATE KEY UPDATE col_name=expression, ... ]

INSERT ... SELECT 構文

INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name [(column list)] SELECT ...

  • INSERT ... SELECT ステートメントでは、1 つまたは複数のテーブルの数多くのレコードを別の 1 つのテーブルにすばやく挿入することができます。

INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100;

例;insert into account2 (login_name) select login_name.account from account where login_name = 'aya';


Last-modified: 2012-03-12 (月) 17:05:42 (166d)