insert into select not in

如果~要把這個表的資料 補到另一個表去,而且是沒有的才補~
語法要怎麼下咧~

INSERT INTO Ping (SN) SELECT SN FROM record WHERE SN NOT IN(select SN from Ping);

先把~待補資料的表~全部查出來~
再比較兩個比~哪些是沒有的~
最後再完成insert into的動作~
解析難嗎?不難~但是~我之前只會用php語法和暫存來處理~

精選文章

讀取中...

This entry was posted in 測試-軟體 and tagged , . Bookmark the permalink.

2 Responses to insert into select not in

  1. Benson says:

    INSERT INTO wp_mail (ID) SELECT ID FROM wp_getinfo WHERE ID NOT IN(select ID from wp_mail)

  2. Benson says:

    insert into wp_mail_data(ID,Title,Content,Url) select ID,post_title,post_content,to_ping from wp_posts where ID not in (select ID from wp_mail_data);

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*


*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>