刚写错了 可以使用right函数 update table set col=right(col,length(col)-2) 可以使用substring函数 update table set col=substring(col,3)
楼上方法不错。update table1 set A字段=mid(A字段,3,10000) where A字段 like '1,%';
如果你的格式是固定的,直接从第3个字符取 mid(A字段,3)
当有多个1,1的时候,就处理不了了。def main(): str='1,11,111,111111,1,23,11,111,11,1,2,11,' str1=[] for lst in str.split(','): if lst<>'1': #str1=str1+','+lst str1.append(lst) print ','.join(str1) if __name__ == '__main__': main()结果是: 11,111,111111,23,11,111,11,2,11,
比较完美的方法: update company_department set Secures = trim(both ',' from replace(concat(',', Secures, ','), ',71,', ','));
然后再使用REPLACE方法
update table set col=right(col,3)
可以使用right函数
update table set col=right(col,length(col)-2)
可以使用substring函数
update table set col=substring(col,3)
mid(A字段,3)
str='1,11,111,111111,1,23,11,111,11,1,2,11,'
str1=[]
for lst in str.split(','):
if lst<>'1':
#str1=str1+','+lst
str1.append(lst)
print ','.join(str1)
if __name__ == '__main__':
main()结果是:
11,111,111111,23,11,111,11,2,11,
update company_department set Secures = trim(both ',' from replace(concat(',', Secures, ','), ',71,', ','));