[MySQL] 把 JOIN 後的結果新增到資料表

INSERT INTO my_results
SELECT
  `unsubscribe`.`email`,
  `customer`.`id`,
  `customer`.`reg_datetime`,
  `customer`.`name`,
  `customer`.`sex`,
  `customer`.`birthday`,
  `customer`.`user_mailok`
FROM `unsubscribe`
LEFT JOIN `customer`
ON `unsubscribe`.`email` = `customer`.`email`;

資料表 my_results 要在跑上面的 SQL 語法前先設定好。


參考連結:

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

返回頂端