mysql update 批量更新多个条件同一个字段
表名:test需要更新的字段:aaa条件字段:uid正常根据uid更新aaa就很简单嘛updatetestsetaaa=123456whereuid=1但是现在有几十个u...
表名:test
需要更新的字段:aaa
条件字段:uid
正常根据uid更新aaa就很简单嘛
update test set aaa=123456 where uid=1
但是现在有几十个uid,而且还是不连续性的怎么搞?
aaa字段都更新为123456
uid列表:
3,4,18,27,70,93,94,95,98,31,41,516,8656,8655,8658,8659,131,8674,8686,8691,8710,8722,8723,8735,8844,8845,8846,8847,8848,8849,8850,8851,8852,8853,8854,8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870,8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901,8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917,8918,8919,8920,8921,8922,8923,8924,8925,8926,8927,8928,8929,8930,8931,8932,8933,8934,8935,8936,8937,8938,8939,8940,10918
就是把以上uid的aaa字段全部改成123456
谢谢了! 展开
需要更新的字段:aaa
条件字段:uid
正常根据uid更新aaa就很简单嘛
update test set aaa=123456 where uid=1
但是现在有几十个uid,而且还是不连续性的怎么搞?
aaa字段都更新为123456
uid列表:
3,4,18,27,70,93,94,95,98,31,41,516,8656,8655,8658,8659,131,8674,8686,8691,8710,8722,8723,8735,8844,8845,8846,8847,8848,8849,8850,8851,8852,8853,8854,8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870,8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901,8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917,8918,8919,8920,8921,8922,8923,8924,8925,8926,8927,8928,8929,8930,8931,8932,8933,8934,8935,8936,8937,8938,8939,8940,10918
就是把以上uid的aaa字段全部改成123456
谢谢了! 展开
2个回答
展开全部
我想你的那个uid 一定是动态查询出来的吧 你可以动态生成sql 如:
update test set aaa=123456 where uid in ();
在括号里你就可以拼接之前查询出来的uid列表咯。
update test set aaa=123456 where uid in ();
在括号里你就可以拼接之前查询出来的uid列表咯。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |