本帖最后由 www130139 于 2012-02-25 11:46:09 编辑

解决方案 »

  1.   

    嘿嘿,这个sql我也不会啊,不过若是一次性的话,可以用程序脚本操作啊,先查出cc_news的记录信息,在查第二章表的,有规律的话可以用like;满足就修改吧!期待sql!
      

  2.   

    try
    update cc_hits,cc_news set cc_hits.catid=cc_news.catid where cc_hits.hitsid = concat('c-1-',cc_news.id);
      

  3.   

    update cc_hits a inner join cc_news b 
    on b.id=right(a.hitsid,1) set a.catid=b.catid 
      

  4.   

    楼上强大~ 建议将right改成substring_indexupdate cc_hits a inner join cc_news b
    on b.id=substring_index(a.hitsid,'-',-1) set a.catid=b.catid 
      

  5.   

    substring_index 比较方便,效率也高一些。