0
我在使用脫機帳戶更新在線數據庫時遇到了問題。不要問......這是一個查理 - 福克斯特羅特,如果你得到我的漂移,但我必須找到一個解決方案。通過一個mysql表來查找並更新其中匹配的地方
我需要發生以下邏輯,這遠遠超出了我的技能組合。導入表中大約有28,000條記錄,成員和成員數據表中大約有2,400條記錄 - 如果這有幫助的話。我希望有一個功能強大的善良功夫可以幫助我。
的表格:
members
id
group_id
member_data
id
account
phone
modified
import
account
phone
所需的邏輯:
Loop through each record in import table and search for match between import.account and member_data.account.
If Match:
Update members.group_id to '5'.
Update member_data.modified to '1'.
If No Match:
Search for match between import.phone and member_data.phone.
If Match:
Update member_data.account with import.account of the matched record.
Update members.group_id to '5'.
Update member_data.modified to '1'.