怎么进行正则表达试替换???
比如说我想
select id,content1,content2 from table where replace(content1,"[a-z]","bb")=replace(content2,"[0-9]","bb");MYSQL怎么写才正确???

解决方案 »

  1.   

    select id,content1,content2 from table where replace(content1,"[a-z]","bb")=replace(content2,"[0-9]","bb");update table set content1 = 'bb',content2='bb' where content1 regexp '[a-z]' and content2 regexp '[0-9]';
      

  2.   

    两条SQL都不同的意思,这不对呐where replace(content1,"[a-z]","bb")=replace(content2,"[0-9]","bb");
    的意思是说把所有字母a到z的都替换成bb,然后进行对比而
    where content1 regexp '[a-z]' and content2 regexp '[0-9]';
    的意思是说内容中是否含有a到z的内容不同的意思
      

  3.   

    那就分句完成。
    create table A select * from B;update B set content1 = 'bb',content2='bb' where content1 regexp '[a-z]' and content2 regexp '[0-9]';
    update A,B set A.content1 = B.content1 and A.content2 =B.content2;