mysql 查詢其他表做update

這只是一篇文記,我不打算詳細說明
主要功能就是把某一個表的資料參照過來做更新

UPDATE file_record
SET tid =    (select cdb_posts.tid from cdb_posts where cdb_posts.pid=file_record.pid)
WHERE EXISTS (select cdb_posts.tid from cdb_posts where cdb_posts.pid=file_record.pid);

精選文章

讀取中...

This entry was posted in 學習筆記 and tagged , . Bookmark the permalink.

發表迴響

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

*


*

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