mysql 设置某个字段为随机整数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011415782/article/details/82688361
  • 场景:

设置更新字段 virtual_pt_sn_count3 到 9 之间(注意区间)的随机整数

  • mysql 执行语句为:
UPDATE ms_goods set virtual_pt_sn_count = FLOOR(3+(rand()*6)) where act_type = 14;
  • 执行结果参考如下:

猜你喜欢

转载自blog.csdn.net/u011415782/article/details/82688361
今日推荐