[英]How to use Counter enabled loop processing of mysql query?
I have a database named creative_db Table name is store_weblinks . 我有一个名为creative_db的数据库。表名为store_weblinks 。 Now inside this table there are several columns that holds the entire site's weblinks.
现在,此表内有几列包含整个网站的网络链接。 My focus is on this column - weblinks_status
我的重点是此专栏-weblinks_status
Now weblinks_status contains 2 values = waiting and live 现在,weblinks_status包含2个值= Waiting and live
So here's what I intend to do - Update any 10 waiting to live status. 因此,这就是我要执行的操作-更新任何10个处于等待状态的状态。
I think I need a loop of some kind that would keep a count of how many successful edits are taking place. 我认为我需要某种形式的循环,以保持对成功编辑进行的计数。 Once that hits 10 it will stop processing..
一旦达到10,它将停止处理。
So, its like this -- Check if the current item of weblinks_status is waiting. 因此,就像这样-检查weblinks_status的当前项目是否正在等待。 If it is waiting then change it to live and increment the loop counter else proceed to the next waiting item..
如果正在等待,则将其更改为活动并递增循环计数器,否则继续进行下一个等待的项目。
Need your help! 需要你的帮助!
Try this STATEMENT: 试试这个陈述:
UPDATE store_weblinks
SET weblinks_status="live"
WHERE weblinks_status="waiting"
LIMIT 10;
This should work to update any 10 entries from waiting to live. 这应该可以使任何10个条目都不再等待直播。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.