问题描述: 需要将表中某一列字段的数据根据同表另一列数据分类设置成相同的值。 sql语句: update tbl a INNER JOIN (select * from ( SELECT b.color, b.renter_name from tbl b where b.value1= 'xx' GROUP BY b.value2 ) c ) d on a.value2 = d.value2 set a.color = d.color where a.value1= 'xx' and a.value2= d.value2 记录一下,也不知道写的有没有什么什么问题,只是刚好解决了自己的问题。