update tx_class set tx_class.school_name tx_school.school_name from tx_school 
where tx_class.school_id=tx_school.school_id

解决方案 »

  1.   

    楼主你这样创建完了你的学校表:school还有什么用?
      

  2.   

    update tx_class a set school_name=(select school_name from tx_school where school_id=a.school_id);
      

  3.   

    update tx_class a set school_name = (select b.school_name from tx_school b where a.school_id = b.school_id)
      

  4.   

    谢谢楼上各位!
    写了一个trg,update了一把,速度比较慢!另,给school_name建索引,建不上(一直无响应)!请问,一般哪些情况索引建不上?:(
      

  5.   

    我需要用的索引是school_name,当然school_id也要建,刚才直接从edit table就可以了,用sql语句执行不了,奇怪^_^……