update inner join
string sql = @"update a set a.M_ParentID=b.M_ParentID, a.M_Name=b.M_Name, a.M_Seq=b.M_Seq from SysMenu_BySchool a inner join ("; foreach (SysMenu_BySchoolEntity m in lstMenu) { sql += string.Format("select {0} ID,{1} as M_ParentID,'{2}' as M_Name,{3} as M_Seq union ", m.ID, m.M_ParentID, Utils2.ValidChar(m.M_Name), m.M_Seq); } sql = sql.TrimEnd(" union ".ToCharArray()); sql += ") b on a.ID=b.ID";