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);

發佈留言

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