mysql 批量update更新數據

#!/bin/sh
 
mysqlconn="mysql -uroot"
db="dbname"
table1="tablename"

while($mysqlconn -N -e "select item_id from $db.$table1 where  matching_status = 0 limit 1;")
do
   #echo 1
   $mysqlconn -e  "update $db.$table1 set  matching_status = 1, matching_fail_reason = null, pim_flag = 0 where matching_status = 0 limit 10000"

done  
發佈了193 篇原創文章 · 獲贊 30 · 訪問量 49萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章